JavaScript Reference :: Option

The easiest way to create an Option object is to get the object from the options property of the Select object. Of course, you may also use document.createElement("option"). Once you have the element, you can assign event handlers or modify the properties.

methods

object toSource()
Returns a literal representing the source code of the object e.g "function Object() { [native code] }" or "function Car(manufactuer, model, productionyear) { this.make = manufactuer; this.model = model; this.year = productionyear; }".
string toString()
Returns a string representing the object i.e. "[object Object]".
void unwatch(property)
Removes a previously set watchpoint.
								
object valueOf()
Returns the primitive value of the object e.g. "function Object() { [native code] }".
void watch(property, handlingFunction)
Calls the handlingFunction when the property is changed.
								

properties

constructor
The constructor method is the base method used to create an instance of the object.
defaultSelected
A boolean indicating whether or not the Option is selected by default.
prototype
Exposes the prototype for the method or property of the object.
selected
A boolean indicating whether or not the Option is selected.
text
The text displayed for the option in the browser.
value
The value associated with the option.

events