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*

6
  • 158
    This is not an answer to the question. this.checked is not jQuery, as the OP asked for. Also, it only works when user clicks on the checkbox, which is not part of the question. The question is, again, How to check whether a checkbox is checked in jQuery? at any given time with or without clicking the checkbox and in jQuery. Commented Jul 6, 2017 at 10:58
  • 1
    How would “is not jQuery” be an argument? That attitude is quite harmful and the reason why it’s so hard to get rid of jQuery nowadays! If you can use vanilla JavaScript from ages ago, which works everywhere and is in no way more complicated to use or longer to write, you should definitely do so. Commented Aug 5, 2022 at 10:55
  • Not only that but jquery is a javascript extension, and therefore contains all of javascript. . In any case "this" is a jquery object so he's completely wrong anyway. Commented Sep 7, 2022 at 22:00
  • 4
    "How would 'is not jquery' be an argument?" Because, while you can indeed use both jquery and plain js on the same script, it's more readable if you use one coding style rather than two. And if you already accepted the jquery tradeoffs, you may as well use it. Commented May 3, 2023 at 14:24
  • People don't code in jquery exclusively. you can't. In any case, jquery isn't a language. It's a library, and you merely have to look at code for checkboxes specifically to see that the programmers can't make up their mind how to set/unset even a simple common control. I just finished fixing one of our site's pages because jquery versions changed and attr no longer worked on checkboxes. javascript doesn't have that problem and the only reason we have jquery at all in our project is it is required by our kendo libraries. Commented Sep 15, 2023 at 20:14