jQuery: preventdefault does not work
- by Kent Miller
I somehow cannot achieve that the a-tag looses its default action when clicking it:
<a href="#" class="button dismiss">dismiss</a>
$(document).ready(function() {
$('.dismiss').click(function(e) {
e.preventDefault();
$('#output').empty();
$('#MyUploadForm .button').show();
});
});
When I click the button, the browser window scrolls to the top. What is wrong here?