Link to home
Start Free TrialLog in
Avatar of hermesalpha
hermesalphaFlag for Paraguay

asked on

How do I get values from select list, checkbox and radio button using getElementById?

How do I get values from select list, checkbox and radio button using getElementById?

I want to get values from a filled out form onto a popup specification. The form contains text, textareas, select lists, checkboxes and radio buttons. To get the values from text and textareas, I can use .value in the end in order to get the filled in value of a text field or text area, like this:

document.getElementById("Specadress").innerHTML=window.opener.document.getElementById("adress").value

Is it the same to get the values for select lists, checkboxes and radio buttons?

In the form, do I need to assign a value for each text field, textarea, option in select list, alternative for checkbox, alternative for radio button?
ASKER CERTIFIED SOLUTION
Avatar of leakim971
leakim971
Flag of Guadeloupe image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of hermesalpha

ASKER

Is this part correct for the select list?:

options[document.getElementById("mySelectID").selectedIndex].value
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks for the points!
No worries - glad to help.