53
rated 0 times
[
57]
[
4]
/ answers: 1 / hits: 24394
/ 12 Years ago, sun, july 8, 2012, 12:00:00
If I have an a
tag:
<a id=delete-event href=/delete/1234>Delete</a>
And some javascript which prompts to confirm the delete:
$(#delete-event).click(function(e) {
e.preventDefault();
bootbox.confirm(Are you sure you wish to delete this?, function(confirmed) {
if(confirmed) {
return true;
}
});
});
I thought doing e.preventDefault()
would prevent the a href
from firing, but its not. When I click the a tag it simply goes to the url, without executing the javascript. How can I make this work?
Thanks.
More From » javascript