美文网首页
多级菜单增删改

多级菜单增删改

作者: 晴晴2021 | 来源:发表于2017-07-22 13:18 被阅读16次

问题1:出现事件冒泡,父级元素的点击事件传递给了子元素。

解决方法:阻止事件冒泡

方法一:function(e){

                    e.stopPropagation();

             }

方法二:return false;

示例:

问题2:jQuery不支持鼠标右键事件:contextmenu。

解决方法:$(".menu-list").bind("contextmenu",function(){

alert(111);

})

问题3:改变this

that= this

示例:

相关文章

网友评论

      本文标题:多级菜单增删改

      本文链接:https://www.haomeiwen.com/subject/ipvnhxtx.html