Generic filters
Exact matches only

How to check if a checkbox has been ticked in Jquery

11th July 2022

Jquery - Forms-Posting

jquery icon

 

Its very easy to add a checkbox in HTML but once it has a tick in the box how can we trigger an action to happen.

This would usually be on a click event of a button, not when the button is ticked, probably use on focus of that box or click event of that box, but not tested.

This will test using jQuery if the checkbox is checked or not.

If I have a checkbox on a form and want to check if it was enabled or checked/ticked I can do so by the following code.

You could also try this, but after revisiting the code above only worked – but it did not turn it off? – Use the code below…

Best way – it’s Javascript!

Was this code snippet helpful?