Finding ID's and Checked status of checkboxes

Finding ID's and Checked status of checkboxes


Hi,
I have a form which I populated with checkboxes having ID based on the records pulled from a table.
eg: Table contains:
ID, Name
30, Some thing
64, Some one
28, Some where
70, Some how

By means of pulling info from the table, the eventual form will be:
<form>
<input type='checkbox' id='30' / >Some thing
<input type='checkbox' id='64' / >Some one
<input type='checkbox' id='28' / >Some where
<input type='checkbox' id='70' / >Some how
<input type='button' onclick='getcheckboxinfo()' />
</form>
Note: if there are more records, there will be more checkboxes. Thus no of checkboxes and their respective ID are kind of unknown.

Is there some method/function in JQuery that I can use to get the ID's and Checked Status of all checkboxes?



















I know that from jquery I can get the number of checkboxes from:
var cbs = $("form input:checkbox"); //find all checkboxes  
var nbCbs = cbs.size(); //the number of checkboxes  

But I need help to get the ID values and the check status of each and every checkboxes.

Thanks






    • Topic Participants

    • d_lmh