access elements inside <div> tag

K

Kenneth

This is probably very simple question but how do you access elements
inside the <div> tag?

I need to access the value of a textfield inside a <div> tag.

Thanks.
 
R

RobG

Kenneth said:
This is probably very simple question but how do you access elements
inside the <div> tag?

I need to access the value of a textfield inside a <div> tag.

Thanks.

Whether your text field is inside a <div> tag or not is probably not
relevant to how you access it.

If the text field is in a form, you can get access to it from the
forms collection. If it's not in a form, give it an ID and use
getElementById. A quick search of this news group on:

"document.forms[" or "document.getElementById"

will turn up hundreds of examples.

You could also use getElementsByTagName, but I suspect one of the
above methods will be better.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,431
Messages
2,571,677
Members
48,796
Latest member
Greg L.

Latest Threads

Top