Question: I used to use the following to know if a clicked item was a checkbox:

```
if ($(e.target).className === 'checkbox') {}

```

After upgrading to the latest version of jQuery this now returns undefined for Chrome, Safari and Firefox.

What is the best way to determine if a click happened on a checkbox?

Thanks

Answer: 
I think you're mixing things up.

`className` is an attribute of an element, not a jQuery object. So if you really wanted to get the class without jQuery, you'd use:

```
e.target.className == "checkbox"

```

But the problem with that is that the `className` may be multiple classes separated by spaces, so you'd want to use a regex or something similar to actually find it.

If you wanted to do it in jQuery, I'd use:

```
$(e.target).hasClass("checkbox")

```

If you are truly looking for a checkbox element, you could use any of the following:

```
e.target.tagName.toLowerCase() == "input" && e.target.type.toLowerCase() == "checkbox"
$(e.target).is("input:checkbox")  // jQuery docs for :checkbox selector suggest including "input"
$(e.target).is('[type="checkbox"]')  // jQuery docs also suggest to use this instead of the above because it's faster than :checkbox in modern browsers

```

<http://api.jquery.com/checkbox-selector/>
```
       $(document).ready(function () {
       $("input:checkbox").click(function () {
           if ($(this).is(":checked")) {
               //Do Stuff if Checked
           } 
       });
   }); 

```