$('#myCheckbox').change(function () {
if ($(this).prop("checked")) {
// checked
return;
}
// not checked
});
Note: In older versions of jquery it was OK to use attr
. Now it’s suggested to use prop
to read the state.
More Related Contents:
- How to bind ‘touchstart’ and ‘click’ events but not respond to both?
- How to trigger a click on a link using jQuery
- Get checkbox value in jQuery
- How to limit the number of selected checkboxes?
- jQuery click events not working in iOS [duplicate]
- How to trigger click event on href element
- jQuery if checkbox is checked
- jquery click doesn’t work on ajax generated content
- Toggle Checkboxes on/off
- Add and remove a class on click using jQuery?
- Get a list of checked checkboxes in a div using jQuery
- What the difference between .click and .change on a checkbox [duplicate]
- Get clicked element using jQuery on event?
- jQuery: fire click() before blur() event
- Using jquery to get all checked checkboxes with a certain class name
- calculate the number of html checkbox checked using jquery
- What are the significant differences among $(sel).bind(“click”, $(sel).click(, $(sel).live(“click”, $(sel).on(“click”?
- jQuery selector for the label of a checkbox
- Using jQuery to programmatically click an link
- How to get the id of the element clicked using jQuery
- Jquery: detect if middle or right mouse button is clicked, if so, do this:
- jQuery set checkbox checked
- Trigger click on select box on hover
- jQuery checkbox event handling
- jQuery: make checkboxes act like radio buttons?
- Click event called twice on touchend in iPad
- Find all unchecked checkboxes in jQuery
- if checkbox checked add class to parent element
- Why isn’t my checkbox change event triggered?
- check uncheck All checkboxes with another single checkbox use jquery