I'm having issues with event.preventDefault()
in firefox, it is not working. This is the jquery code.
$("#facebook-del-1").click(function(){
event.preventDefault();
var selector = "#"+$(this).attr("id");
$(selector).closest('a.tag').remove();
});
It is working in Chrome, but not in firefox. You can check out here http://jsfiddle.net/qXPj8/2/
Could anyone guide me?
Thanks!
as the other answers have stated, you should pass the "event" argument to the handler method. if you do not want to pass the "event" argument along, you should be able to "return false" at the end of your method and disable default behavior.
Pass the event argument to the handler function,
Fixed fiddle: http://jsfiddle.net/skram/qXPj8/6/
It seems that you have forgotten event argument:
Please refer to event.preventDefault docs page.