For getting the form both the name and the number can be used, like here: document.forms.myForm - the form with name="myForm", document.forms[0] - it's the first form in the document. These methods operate exactly with what’s written in HTML. For instance: These navigation properties do not depend on the tag structure. JavaScript Array Reference. Also, they have elements property, which is controlled by the lists form inside them. The text box is perhaps the most common form object you'll read (or write) using JavaScript. Show the value and the text of the selected option. List of objects recognized by all browsers, with the source code, and how to use them. Hence, you can use the first way that is add/remove the selected property