试图绕过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 ×1