tags:

views:

156

answers:

3

Hi, I am having a div like

<div style="" id="listColumns">
   <input type="checkbox" id="77"/>Name
   <input type="checkbox" id="78"/>Designation
   <input type="checkbox" id="79"/>Address
   <input type="checkbox" id="80"/>Email - Id
   <input type="checkbox" id="81"/>Date Of Birth
</div>

I am trying to find what are all fields are checked using JQuery. How to do so?

+5  A: 
$("input:checked")

Go to the docs to read more about jQuery's powerful selectors.

geowa4
you can then do .length on this to check if anything was found.
Fermin
+4  A: 
$("#listColumns :checked").each(function() {

    alert(this.id + " is checked");

});
Philippe Leybaert
A: 

You may get better performance by splitting out the selectors.

$("#listColumns").find("input:checked").each(function() {
       alert(this.id);
});
bryanbcook