0
왜 이것이 작동하지 않는지 이해할 수있는 사람이 있습니까?JQuery는 하나의 동작 만 수행합니다.
<div id="css-check" class="css-check tool-tip checkbox inline" ...
<input id="someid" name="somename" type="checkbox" value="somevalue" />
</div>
$('.css-check').bind({
click: function() {
$(this).toggleClass('clicked');
this.children[0].click();
},
mouseenter: function() {
// do something on mouseenter
}
});
첫 번째 작업 만 수행됩니다. 따라서 클래스는 토글되지만 div의 [0] 자식 인 체크 상자는 클릭되지 않습니다.
편집
이 작동합니다.
var $checkbox = $(this).children('input:first-child');
$checkbox.prop('checked', !$checkbox[0].checked);
$(this).toggleClass('clicked');
오신 것을 환영합니다 : 이것은 당신이 다음 확인란을 선택하려는 경우 사용, 클릭 이벤트를 트리거 스택 오버플로! 해결책으로 답을 추가하십시오. –