Get checked state of a switchery checkbox in jquery -
i have following code:
<div class="form-group col-xs-1"> <label for="closed" class="control-label">hide closed</label> <input name="closed" type="checkbox" id="closed" class="form-group js-switch" checked /> </div> $('#closed').on('change', function() { if ($('#closed').is(':checked')) { closed = 1; } else { closed = 0; } console.log(closed); });
but when change status of checkbox, see false.
stupid mistake part, cannot use closed variable. if use different name working. sorry trouble...
Comments
Post a Comment