我想在用户单击/触摸复选框后提交表单:
HTML
<input type="checkbox" name="chkSales" id="chkSales" class="custom" data-inline="true" data-mini="true"/><label for="chkSales">Sales</label>
<input type="checkbox" name="chkArrival" id="chkArrival" class="custom" data-inline="true" data-mini="true"/><label for="chkArrival">New Arrival</label>
Js:
$("input[type='checkbox']").change(function() {
alert(e);
print(e);
});
从我在这里读到的内容来看,它应该确实有效,但 id 确实有效!我的问题出在哪里?
(应该改变,因为移动设备不点击,它们使用触摸...... http://jsfiddle.net/usTHG/2/
最佳答案
$("input[type='checkbox']").change(function(e) {
^---- you missed e here
alert(e.type);
print(e);
});
<强> Working example
关于jquery - 复选框绑定(bind) CHANGE 事件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11114056/