Home » , » How to check if checkbox is checked using jQuery

How to check if checkbox is checked using jQuery

Written By GA Team on Thursday 19 February 2015 | 10:13 pm

GNN Ads

(GNN) - I needed to find if a checkbox was checked in jquery but I knew of multiple ways to do this. But I wasn’t sure of the best way to perform this task.

Still I haven’t decided on the best way to do this so I was hoping someone with much greater knowledge than me in the inside-outs of the jQuery could help me out here. Out of the following examples what would be the best way to discover if a checkbox has been checked or not.

Using Attribute Method

This will check to see if there is an attribute on the element which is called checked.

Using the IS Method Selector

This method will check to see if the element is checked.

Checked Selector

Get all elements which are currently checked by using the following snippet.

Using @ Attribute Method

This will use a @ selector which will define a search for an attribute on the element. So the below code will search for any element with type checkbox and if it is checked.

GNN Ads

Join Our Email Newsletter Now!

Join over 10,000 people who get free and fresh content delivered automatically each time we publish.

https://lh4.googleusercontent.com/-7ZpSgX9Y-dc/UPkMMxmfkRI/AAAAAAAAVQA/nyPxtCTQwtQ/s125/advertise125x125.gif.png https://lh4.googleusercontent.com/-7ZpSgX9Y-dc/UPkMMxmfkRI/AAAAAAAAVQA/nyPxtCTQwtQ/s125/advertise125x125.gif.png https://lh4.googleusercontent.com/-7ZpSgX9Y-dc/UPkMMxmfkRI/AAAAAAAAVQA/nyPxtCTQwtQ/s125/advertise125x125.gif.png https://lh4.googleusercontent.com/-7ZpSgX9Y-dc/UPkMMxmfkRI/AAAAAAAAVQA/nyPxtCTQwtQ/s125/advertise125x125.gif.png

Total views

Advertise Here

Most Popular Posts

Latest

Advertise with GNN

Advertise with GNN P/D
GNN ADS