Checkbox bind CHANGE event
22,018
Solution 1
$("input[type='checkbox']").change(function(e) {
^---- you missed e here
alert(e.type);
print(e);
});
Solution 2
Try this please:
you are missing e
in your function(e
)
code
$("input[type='checkbox']").change(function(e) {
alert(e);
print(e);
});
Solution 3
try:
$(document).ready(function() {
$("input[type='checkbox']").change(function(e) {
alert(e);
print(e);
});
});
Author by
ItsMeDom
A passionate programmer with roots in c, c++, c#, vb.net. Coming from php, mysql, javascript now stepping into swift and xcode to bring awesome apps to the world.
Updated on June 20, 2020Comments
-
ItsMeDom almost 4 years
I want to submit my form after a user clicked/touched the checkbox:
THE 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>
The 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?
(it should be change, since mobile devices don't click, they use touch... http://jsfiddle.net/usTHG/2/