Checkbox Bind CHANGE Event

I want to submit my form after the user clicked / touched the checkbox:

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); });​ 

From what I read here, it should really work, but id doenst! where is my problem

(this should be a change, as mobile devices do not click, they use touch ... http://jsfiddle.net/usTHG/2/

+4
source share
3 answers
 $("input[type='checkbox']").change(function(e) { ^---- you missed e here alert(e.type); print(e); });​ 

Working example

+16
source

Try the following:

you are missing e in your function ( e )

the code

 $("input[type='checkbox']").change(function(e) { alert(e); print(e); });​ 
+3
source

to try:

 $(document).ready(function() { $("input[type='checkbox']").change(function(e) { alert(e); print(e); }); }); 
+1
source

All Articles