Sunday, 8 January 2012

HTML DOM Select Object


Select Object

The Select object represents a dropdown list in an HTML form.
A dropdown list lets a user select one or more options of a limited number of choices.
For each <select> tag in an HTML form, a Select object is created.
You can access a Select object by searching through the elements[] array of a form, or by using document.getElementById().

Select Object Collections

W3C: W3C Standard.
CollectionDescriptionW3C
optionsReturns a collection of all the options in a dropdown listYes

Select Object Properties

PropertyDescriptionW3C
formReturns a reference to the form that contains the dropdown listYes
lengthReturns the number of options in a dropdown listYes
multipleSets or returns whether more than one item can be selected from the dropdown listYes
nameSets or returns the name of a dropdown listYes
selectedIndexSets or returns the index of the selected option in a dropdown listYes
sizeSets or returns the number of visible options in a dropdown listYes
typeReturns which type of form element a dropdown list isYes

Select Object Methods

MethodDescriptionW3C
add()Adds an option to a dropdown listYes
remove()Removes an option from a dropdown listYes

Standard Properties, Methods, and Events

No comments:

Post a Comment