미래에 생성되는 모든 요소에 기능을 추가하고 있습니다. <div id="content">
<div id="content">
<h3 id="title">tiltle</h3>
</div>
<script>
$("#content").on("click","*",function(){($(this).hide();});
</script>
이것은 잘 작동하지만이 기능을 <h3 id="title">
시도 하고 싶지 않습니다.
<div id="content">
<h3 id="title">tiltle</h3>
</div>
<script>
$("#content").on("click","*.not('#title')",function(){($(this).hide();});
</script>
그러나 이것은 작동하지 않습니다. 누구든지 효율적인 솔루션을 찾도록 도와 줄 수 있습니까?
사용 :not()
의사 클래스 선택기
$("#content").on("click",":not(#title)",function(){
$(this).hide();
});
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다