div "containerDIV"내부에서 변경된 체크 박스를 "얻으려면 어떻게해야합니까?JQUERY ON ('change') 체크 박스 값과 상태 가져 오기
보기 :
@model MyModel
<div id="containerDIV">
<ul id="CheckBoxList">
@foreach (XObject t in MyModel.XCollection)
{
<li>
<input type="checkbox" value="@t.id"/>
</li>
}
</ul>
자바 스크립트 (jQuery를) 측면에서
, 난이 있습니다,
$('#containerDIV').on('change', '#CheckBoxList', function (event) {
var id = $(this).val(); // this gives me null
if (id != null) {
//do other things
}
});
그것은 $this
체크 박스 아니라는 것을 분명이 사업부의 containerDIV
또는 checkBoxList
어떻게 채널에 연결할 수 있습니까? eckbox의 상태와 가치?
'event.target'이 작동합니다 @billyonecan 변경 이벤트 – billyonecan
를 실행 한 DOM 요소가 될 것입니다,하지만 난에 노력하고있어 – Tuco