But the question here is how do i call the checked property in javascript.
Like something we have document.forms[0]. something something..
How do i get the value. There will be multiple checkboxes and i want to know the checkboxes selected.
Will be grateful if you provide some code snippet based on my example.
Same way as with any other DOM form element (although the brackets in the name will require not using the normal dot-notation, I think?)
Sachin Ag
Greenhorn
Joined: Sep 15, 2010
Posts: 5
posted
0
Sir i have tried all possible way. Probably we need to iterate through something and then check individually if the checkbox was selected.
I tried to fetch something like this : document.forms[0].details[0].checked -- > this gave me error
document.forms[0].details -- > this gave me undefined
document.forms[0].availablePaymentDetailsList --> undefined
document.forms[0].availablePaymentDetailsList.length --> error
Sachin Ag wrote:
I tried to fetch something like this : document.forms[0].details[0].checked -- > this gave me error
document.forms[0].details -- > this gave me undefined
As it should. Your checkbox's name is "details[0].checked". Your examples try to dereference document.forms[0].details and there's nothing there. Try something like:
It gave me an alert of [object] and not the value though it's value was true. Can you please suggest me some other alternative.
Also how will I come to know the length of the arraylist in javascript.