THE WORLD'S LARGEST WEB DEVELOPER SITE
HTMLCSSJAVASCRIPTSQLPHPBOOTSTRAPJQUERYANGULARXML
 

HTML DOM Option Object


Option Object

The Option object speaks to a HTML <option> element.

Access an Option Object

You can get to a <option> component by utilizing getElementById():

var x = document.getElementById("myOption");

Tip: You can likewise get to an Option object via seeking through the elements gathering of a structure, or the options accumulation of a drop-down list.

Create an Option Object

You can make a <option> component by utilizing the document.createElement() method:

var x = document.createElement("OPTION");

Option Object Properties

Property Description
defaultSelected Returns the default estimation of the chose attribute
disabled Sets or returns whether a choice is debilitated, or not
Returns a reference to the structure that contains the option
index Sets or returns the file position of a choice in a drop-down list
label Sets or returns the estimation of the mark property of an alternative in a drop-down list
selected Sets or returns the chose condition of an option
text Sets or returns the content of an option
value Sets or returns the estimation of an alternative to be sent to the server