jQuery의 이벤트 위임을 사용하여 테이블 이벤트에 클릭 이벤트를 추가하고 있습니다. 또한 행의 첫 번째 td에 체크 박스가 있습니다. 행의 아무 곳이나 클릭하면 모든 것이 예상대로 작동합니다. 그러나 확인란을 클릭하면 이벤트가 작동하지 않습니다. : not() 셀렉터를 사용해 보았습니다. 그러나 체크 박스를 클릭했을 때 여전히 이벤트를 트리거하고 있기 때문에 아마도 뭔가 빠졌습니다.td 내의 체크 박스를 무시하는 방법
HTML
<tr>
<td>
<div class="myCheckbox"><input type="checkbox" name="userName" /></div>
</td>
<td><a href="/go/to/user/profile"></a></td>
<td>more info</td>
<td>more info</td>
<td>more info</td>
</tr>
jQuery를
$('table tr:not(':checkbox')').on('click', 'td', function(event) {
// Do something
});
내가하려고하는 것을 수정하는 데 도움을받을 수 있습니까?
가능한 중복 (http://stackoverflow.com/questions/1398582/prevent-execution-of-parent-event-handler)의 –