问题
The following jquery script is not working in firefox. Anyone with a idea on how to correct it?
$(document).ready(function () {
$('#all_lists').hide();
$('#add_lists').click( function(){
event.stopPropagation();
$('#all_lists').toggle();
});
$(document).click( function(){
$('#all_lists').hide();
});
});
回答1:
You need to pass event
as an argument in the click function like:
$('#add_lists').click( function(event){
^ ^
回答2:
javascript:jQuery('body').toggleClass('open');
Using JS on an image map was returning [object, Object] in a new window in Firefox only. Fixed with:
javascript:jQuery('body').toggleClass('open');void(0);
来源:https://stackoverflow.com/questions/19346384/jquery-toggle-not-working-in-firefox