Latest web development tutorials

HTML DOM Option objects

Option Object

Option object represents an HTML form of a list of drop-down options.

In the HTML form <option> tag appears every time a Option object is created.

You can form the elements [] array access an Option object, or by using document.getElementById ().


Option Object Properties

W3C: W3C standards.

属性 描述 W3C
defaultSelected 返回 selected 属性的默认值。 Yes
disabled 设置或返回选项是否应被禁用。 Yes
form 返回对包含选项的表单的引用 Yes
index 返回对包含该元素的 <form> 元素的引用。 Yes
selected 设置或返回 selected 属性的值。 Yes
text 设置或返回某个选项的纯文本值。 Yes
value 设置或返回被送往服务器的值。 Yes

Standard properties and events

Option objects also supports the standard attributes and events .