Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

Troubleshooting
Research
Professional Opinions
Ask a Question
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

troubleshooting Question

Find ID and Values of Checkboxes from a form

Avatar of LimMH
LimMH asked on
Scripting LanguagesJScriptjQuery
4 Comments1 Solution249 ViewsLast Modified:
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 unknown.

In the javascript function, how do I get the ID's of all checkboxes and their checked status?
If it's possible, having the answer in jquery will be best.
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 checkstatus of each and every checkboxes.

Thanks
ASKER CERTIFIED SOLUTION
Avatar of Terry_focus
Terry_focusFlag of United Kingdom of Great Britain and Northern Ireland image

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Commented:
This problem has been solved!
Unlock 1 Answer and 4 Comments.
See Answers