<button type="submit" class="btn" id="cancel_me">
Cant Click Me!
</button>
And you want to prevent the default behaviour using jQuery in order to perform some other action
Here is the code that you need to do:
$(function() {
$("#cancel_me").click(function(e) {
e.preventDefault();
/*Do Things*/
});
})
And where it says "Do Things" insert the new behaviour you want to override with.
The preventDefault() method does the magic trick!
No hay comentarios:
Publicar un comentario