How to check / unchecked a checkbox with jQuery

In jQuery, you can use attr() function to check or unchecked a checkbox dynamically. For example,

A simple checkbox component.

<input type="checkbox" name="checkme">Check Me</input>

1. To display whether this checkbox is checked or not (return true or false).


2. To check a checkbox.


3. To uncheck a checkbox.


jQuery check / unchecked checkbox example

<title>jQuery check / uncheck a check box example</title>
<script type="text/javascript" src="jquery-1.3.2.min.js"></script>
<h1>jQuery check / uncheck a check box example</h1>
<script type="text/javascript">
    $("#isCheck").click(function () {
    $("#checkIt").click(function () {
    $("#UnCheckIt").click(function () {
<input type="checkbox" name="checkme">Check Me</input>
<input type='button' value='Is Check' id='isCheck'>
<input type='button' value='Check It' id='checkIt'>
<input type='button' value='UnCheck It' id='UnCheckIt'>
Tags :

About the Author

Founder of and, love Java and open source stuff. Follow him on Twitter, or befriend him on Facebook or Google Plus. If you like my tutorials, consider make a donation to these charities.


  • Prabu karana
  • Arun

    Really nice article. I am sharing another article which too discusses about checking and un-checking a group of checkboxes defined inside a class. But this article uses the ‘.prop()’ function instead of ‘.attr()’ function. Please check it and let us know if it has helped you.

    Reviews awaited.

  • satyendra

    You examples are very nice and simple

  • uzma Abbasi

    very well done.nice job.

  • AntGuider

    This is a nice example. You can Refer this article for
    How to check a checkbox is checked using jQuery” in different ways

  • B


  • Jigar Shah

    With struts2 rendered check boxes it does nto work…since they are sending hidden values -checkboxes…which do not change if u have hidden and now visible checkboxes.