admin管理员组

文章数量:1317898

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();
});

});

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();
});

});
Share Improve this question asked Oct 13, 2013 at 14:37 acaciaacacia 1,3871 gold badge14 silver badges41 bronze badges 2
  • 1 You need to pass event in the click function like $('#add_lists').click( function(event){ – Sergio Commented Oct 13, 2013 at 14:37
  • In your #add_lists click-handler, add event argument to the function. – Guillaume Poussel Commented Oct 13, 2013 at 14:38
Add a ment  | 

2 Answers 2

Reset to default 8

You need to pass event as an argument in the click function like:

$('#add_lists').click( function(event){
                                ^   ^

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);

本文标签: javascriptJquery toggle not working in FirefoxStack Overflow