Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

11
  • 2
    Another way is $('#'+id).attr('checked'), which is equivalent to $('#' + id).is(":checked") but easier to remember IMO. Commented Sep 3, 2011 at 13:37
  • 93
    @Zubin: Be careful with .attr('checked'). Its behavior changed in jQuery 1.6. It used to return false or true. Now it returns undefined or "checked". .is(':checked') does not have this problem. Commented Apr 7, 2012 at 7:16
  • 1
    @John Boker: sorry for the necro comment but, why is it that $('.ClassName').is(':checked') doesn't seem to work but $('#' + id).is(":checked") does? aside from the fact that one looks up by id and one by classname. Commented Apr 16, 2013 at 21:08
  • 6
    Note: size() has been deprecated since jQuery 1.8 - use .length instead Commented Jul 9, 2013 at 19:14
  • 2
    $('#'+id).prop('checked') will return either true or false. Commented Jul 20, 2016 at 18:01