How do you I stop my links like this:
<a href="#" onClick="submitComment()">
From jumping to the top of the page after the click?
How do you I stop my links like this:
<a href="#" onClick="submitComment()">
From jumping to the top of the page after the click?
You could use this alternative syntax instead:
<a href="javascript:submitComment()">
<a href="#" onClick="submitComment(); return false;">
Or with jQuery:
$("a#myLink").bind("click", function(e){
e.preventDefault(); /* prevents default behavior */
submitComment();
});
Add a return false. I believe that without that the page will reload.
<a href="#" onClick="submitComment(); return false;">