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*

4
  • 4
    The first solution is missing :... Correct one is: if(('input[name="checkBoxName"]').is(':checked')). Commented Oct 19, 2016 at 15:12
  • Missing dollar sign ($), it should be if($('input[name="checkBoxName"]').is(':checked')). Commented Nov 8, 2018 at 2:13
  • 1
    The second one will never run the else block, since a jQuery object, even if it contains no matching elements, is "truthy". Add .length to the end, then you're talking. Commented Aug 7, 2019 at 18:56
  • Thanks! if($('input[name="checkBoxName"]').is(':checked')) is worked find, BUT $('input[name="checkBoxName"]:checked') didn't work. Commented Apr 26, 2023 at 8:19