Check if checkbox input is checked using jQuery

Written by Saran on July 20, 2015, Updated July 20, 2016

We used .attr() method to get the attribute value of a checkbox. Which would return "checked" if the checkbox state is checked. But as of jQuery 1.6 it will return undefined if checkbox state is not set.
Therefore, if you are still using previous jQuery, you can check state of checkbox input like so :

About Sanwebe.com

Sanwebe.com was founded in 2011 by Saran Chamling. A blog truely inspired by the ever changing web development world. It is a small effort to provide useful tips, tutorials and related resources to web developers.