Jquery toggle not working in Firefox

社会主义新天地 提交于 2021-01-27 19:00:07

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!