javascript - Both event.preventDefault() and event.returnValue = false don't work in Firefox -
i have tried these snippets of codes, first 1 works in ie , chrome, second 1 works in chrome only, both of them don't work in firefox. want stop page going other pages via links
$('.album a').click(function(){ event.returnvalue = false; //other codes }) $('.album a').click(function(){ event.preventdefault(); //other codes })
edit: snippet ian worked me
$('.album a').click(function(e){ e.preventdefault(); //other codes });
you need provide event
parameter:
$('.album a').click(function(e){ e.preventdefault(); //other codes });
you don't need deal returnvalue
, jquery normalizes method work across browsers, calling preventdefault
.
note how handler in docs show eventobject
parameter passed it: http://api.jquery.com/click/
and note how event
object has preventdefault
method: http://api.jquery.com/category/events/event-object/
Comments
Post a Comment