여러 사람들이 내가 친절하게 고정하는 방식으로 응답 사람 this question 어제, 게시
내가 ... 온 클릭 onchange를 혼합했던 지적 편집 내 문제는 아니지만 나는 왜 $("#selector").click
메톤이 작동하는지 알지 못하지만 onchange=(...)
은 그렇지 않습니다.
그래서 HTML 헤더에있는 클릭 일상 DataTable의 종류 화재 부모 요소 DataTable을 cloumn 헤더에있는 경우 :
<div>
<input type="checkbox" id="select_all" onchange="SelectAll(event)">
SELECT ALL
</div>
//This is hit only AFTER the sort routine from the parent element is fired.
function SelectAll(event) {
event.stopPropagation();
var boxes = document.querySelectorAll("[name*=\"include_\"]"); //All checkboxes prefixed "include_".
var chk = document.getElementById('select_all').checked;
for (var i = 0; i < boxes.length; i++) {
if(!boxes[i].disabled) {
boxes[i].checked = chk;
}
}
}
//This is hit BEFORE the sort routine from the parent element is fired.
$("#select_all").click(function(event){
event.stopPropagation()
});
}
두 번째 방법, 부모 요소의 클릭 이벤트 전에 해고를, 작품을 나를위한, 그러나 2의 기본적인 차이점은 무엇입니까? onchange
논리에서
onclick이 아니라 onChange 이벤트를 사용하고 있습니다. 일부 브라우저에서는 onchange가 포커스를 잃을 때만 onchange가 시작됩니다. –