클릭 이벤트가 <tr>
인이 jQuery 코드가 있습니다. 이 이벤트는 특정 <td>
을 클릭하면 실행되지 않습니다. 지금 가지고있는 코드는 훌륭하지만, 지금은 클릭했을 때 <tr>
의 이벤트가 트리거되지 않아야하는 조건을 하나 더 추가하려고합니다.Jquery : a 및 selector가 있습니까?
<span></span>
을 추가하려고합니다.이 버튼을 클릭하면 <tr>
에서 이벤트가 트리거됩니다. 이 작동하지 않는
// Change background color on rows in new candidates list
$(".newCandidatesTableTr td:not(#testTD) span:not(#candidateID)").click(function() {
$(this).parent().siblings().removeClass("diffColor");
$(this).parent().toggleClass("diffColor", this.clicked);
});
:
span:not(#candidateID)
내가 이걸 어떻게해야합니까
다음 내 코드? 다음,// Change background color on rows in new candidates list
$(".newCandidatesTableTr td[id!=testTD] span[id!=candidateID]").click(function() {
$(this).parent().siblings().removeClass("diffColor");
$(this).parent().toggleClass("diffColor", this.clicked);
});
약간의 HTML을 표시 할 수 있습니까? –
복잡한 클릭 이벤트를 관리하기 위해 이벤트 위임을 사용하는 것이 좋습니다. – Berzemus