Skip to content

jQuery: Prevent Href/Hyperlink

This snippet will prevent the default behaviour of a hyperlink

<a href=”#”>Go </a>

<script>
$(document).ready(function(){
$(‘#do-nothing’).click(function(e) {
e.preventDefault();
});
});
</script>

Share