Reputation: 46222
I have a checkbox with an id of activelist
I tried the following but did not seem to work (I have below in) :
$(document).ready(function () {
$('#activelist :checkbox').change(function () {
alert('changed');
});
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<input type="checkbox" id='inactivelist' value="inactivelist" />
Upvotes: 36
Views: 173187
Reputation: 561
$('input[type=checkbox]').change(function () {
alert('changed');
});
Upvotes: 7
Reputation: 15338
There is no need to use :checkbox
, also replace #activelist
with #inactivelist
:
$('#inactivelist').change(function () {
alert('changed');
});
Upvotes: 54
Reputation: 3754
There is a typo error :
$('#activelist :checkbox')...
Should be :
$('#inactivelist:checkbox')...
Upvotes: 6