相关疑难解决方法(0)

jQuery:点击功能排除孩子.

试图绕过jQuery".not()"函数,并遇到问题.我希望父div可以"可点击"但如果用户点击子元素,则不会调用该脚本.

$(this).not(children()).click(function(){
   $(".example").fadeOut("fast");
});
Run Code Online (Sandbox Code Playgroud)

html:

<div class="example">
   <div>
      <p>This content is not affected by clicks.</p>
   </div>
</div>
Run Code Online (Sandbox Code Playgroud)

jquery

136
推荐指数
5
解决办法
11万
查看次数

标签 统计

jquery ×1