0

is there a simple way to find out if a checkbox is checked in jquery.

something like .checked or ischecked

3

1 Answer 1

8
el.is(':checked')

That's the jQuery way. At its core, though, it's just a bit more parsing to get down to el[0].checked, using the raw DOM property, so take whichever you prefer. The DOM method is probably better for actually testing an element, whereas :checked is better for selecting it in the first place.

Sign up to request clarification or add additional context in comments.

1 Comment

el[0].checked, no reason to not use the DOM property when in an if statement, it's much faster :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.