Use .is(':checked')
to determine whether or not it’s checked, and then set your value accordingly.
More Related Contents:
- How do I check whether a checkbox is checked in jQuery?
- How to get the children of the $(this) selector?
- Get selected text from a drop-down list (select box) using jQuery
- Check if checkbox is checked with jQuery
- How can I select an element by name with jQuery?
- How do I get jQuery to select elements with a . (period) in their ID?
- jQuery selectors on custom data attributes using HTML5
- How can I get selector from jQuery object
- Select all elements that have a specific CSS, using jQuery
- jQuery difference between change and click event of checkbox
- jQuery DOM changes not appearing in view source
- How to check all checkboxes using jQuery?
- jQuery : select all element with custom attribute [duplicate]
- jquery attr(‘checked’,’checked’) works only once
- Selecting multiple classes with jQuery
- What the difference between .click and .change on a checkbox [duplicate]
- How do you check if a selector matches something in jQuery? [duplicate]
- Not class selector in jQuery
- jQuery single selector vs .find()
- Using jQuery to search a string of HTML
- jQuery find and replace string
- Possible to associate label with checkbox without using “for=id”?
- How to check in js that user has checked the checkbox in Google recaptcha?
- How to reset all checkboxes using jQuery or pure JS?
- Is there a ‘has focus’ in JavaScript (or jQuery)?
- jQuery support “:invalid” selector
- Combine two selectors with one jQuery object
- How to select empty inputs (value=””) using jQuery
- What is the new proper way to use a child selector with a context node in jQuery?
- jQuery: Select data attributes that aren’t empty?