I’ve simple question about link with anchor and Jquery.
<a href="#" id="link">A Link</a>
<script>
$("#link").click(function() {
//some actions
}
</script>
How , when i click on the link, not to follow the link. I mean the page back up everytime..
Use the
preventDefaultmethod:You can put the
preventDefaultcall before or after your actions, depending on what fallback behaviour you want. If you put it first the link will never be followed. If you put it last, the link will be followed if the script crashes.