Check / Uncheck checkbox using jquery
 
SamBlaze

jQuery is a fast, small, and feature-rich JavaScript library. It makes things like HTML document traversal and manipulation, event handling, animation, and Ajax much simpler with an easy-to-use API that works across a multitude of browsers. With a combination of versatility and extensibility, jQuery has changed the way that millions of people write JavaScript.

It is very easy to check/uncheck a checkbox using jQuery. To do so you need to use the attribute checked and alter that. With jQuery you can do in this way:

However, some cases you can not trust .attr() method to get the value of the checkbox (if you need to). You will have to rely in the .prob() method.

So, for jQuery 1.6+

You can use the new function .prop() as:

Leave a Reply

Your email address will not be published. Required fields are marked *


three × 6 =

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">

Check / Uncheck checkbox using jquery

jQuery is a fast, small, and feature-rich JavaScript library. It makes things like HTML document traversal and manipulation, event handling, animation, and Ajax much simpler with an easy-to-use API that works across a multitude of browsers. With a combination of versatility and extensibility, jQuery has changed the way that millions of people write JavaScript.

It is very easy to check/uncheck a checkbox using jQuery. To do so you need to use the attribute checked and alter that. With jQuery you can do in this way:

However, some cases you can not trust .attr() method to get the value of the checkbox (if you need to). You will have to rely in the .prob() method.

So, for jQuery 1.6+

You can use the new function .prop() as:

Leave a Reply

Your email address will not be published. Required fields are marked *


five − = 3

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">