复选框绑定CHANGE事件

Its*_*Dom 6 jquery events bind

我想在用户点击/触摸复选框后提交表单:

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>                                                         
Run Code Online (Sandbox Code Playgroud)

Js:

$("input[type='checkbox']").change(function() {
    alert(e);
    print(e);
});?
Run Code Online (Sandbox Code Playgroud)

从我在这里阅读它应该真的有用,但id doenst!我的问题在哪里?

(应该是改变,因为移动设备不点击,他们使用触摸... http://jsfiddle.net/usTHG/2/

the*_*dox 18

$("input[type='checkbox']").change(function(e) {
                                            ^---- you missed e here
    alert(e.type); 
    print(e);
});?
Run Code Online (Sandbox Code Playgroud)

工作实例

  • 10秒差异大声笑:) +1反正布鲁夫! (2认同)