For those with javascript enabled, click on them to do OnClick ()
For those with javascript disabled click on them, just go to where.html,
Assuming only $ ('# link') is available, how to do this?
Like this:
$('#link').click(function() { //... return false; });
Once written return false , the link won't execute.
return false
If Javascript is disabled, no click handler will be added and the link will behave normally.
$ ("# link"). bind ("click", function (e) {alert ("clicked"); e.preventDefault (); return false;});
This will trigger "clicked" and then undo the default action. If Javascript is disabled the link will follow.
Use a function click . Add return false to the end of your function to prevent the default action of clicking following the hyperlink:
click
$("#link").click(function() { onClick(); return false; });