Home Articles FAQs XREF Games Software Instant Books BBS About FOLDOC RFCs Feedback Sitemap
irt.Org
#

Q1701 How can I get the value of a text input field without using the name of the field?

You are here: irt.org | FAQ | JavaScript | Form | Q1701 [ previous next ]

Use its position within the elements array. For example, the following retrieves the value of the 2nd element:

<form>
<input type="button" value="show value" onClick="alert(this.form.elements[1].value)">
<input type="text" value="Hello world">
</form>

©2018 Martin Webb