Hey guys.
How to get all child objects inside of an object.
For example; I have a form and I want to get all the textfields, checkboxes, radio buttons, buttons, etc. with their names and values.
How to do it?
Printable View
Hey guys.
How to get all child objects inside of an object.
For example; I have a form and I want to get all the textfields, checkboxes, radio buttons, buttons, etc. with their names and values.
How to do it?
Uhm....Quote:
Originally Posted by eSPiYa
Let me guess....
document.form[0].getElementsbyTagName("input").name
document.form[0].getElementsbyTagName("input").value
Maybe it is a good alternative.
How about getting child elements regardless of tag?
Uhm....Quote:
Originally Posted by eSPiYa
Let me guess....
document.form[0].all.name
document.form[0].all.value
:bigyello:
Is that close enough?
Is there a property/function all?
Have you tried all?Quote:
Originally Posted by eSPiYa
Nope.
Can you try all?
It's document.forms and there is no property all. Just iterate over document.forms[n] and you'll get all of the input controls.
Code:for (c in document.forms['myform'])
c.style.color = 'red';
What is c?
Ok. Thanks.
That is what I need.
Yeah. Sorry about that. My javascript as of now sucks.Quote:
Originally Posted by penagate
I alway mix HTML Library object with javascript.