Option defaultSelected attribute

Definition and Usage

defaultSelected attribute returns selected attribute the default value.

If the default selected option, this property returns true, otherwise return false.

Note:If an option is selected by default, it is displayed first in the drop-down list.

See also:

HTML Reference Manual:HTML <option> ਟੈਗ

Example

Check if the selected option is selected by default:

var x = document.getElementById("mySelect").selectedIndex;
var y = document.getElementsByTagName("option");
alert("Is \"" + y[x].text + "\" selected by default? \"" + y[x].defaultSelected + "\");

ਸਵੈ ਮੁਕੰਮਲ ਕਰੋ

ਗਿਆਨਾ

optionObject.defaultSelected

ਤਕਨੀਕੀ ਵੇਰਵੇ

ਵਾਪਸ ਦਿੱਤਾ ਗਿਆ ਮੁੱਲ: ਬੁਲੀਨ ਮੁੱਲ, ਜੇਕਰ ਇਹ ਵਿਕਲਪ ਮੂਲਤਬੀ ਚੁਣਿਆ ਗਿਆ ਹੈ, ਤਾਂ true ਵਾਪਸ ਦਿੱਤਾ ਜਾਵੇਗਾ; ਹੋਰ ਤਰ੍ਹਾਂ false ਵਾਪਸ ਦਿੱਤਾ ਜਾਵੇਗਾ。

ਬਰਾਉਜ਼ਰ ਸਮਰਥਨ

ਚਰਮੋਨੀ ਐਜ਼ ਫਾਇਰਫਾਕਸ ਸੈਫਾਰੀ ਓਪੇਰਾ
ਚਰਮੋਨੀ ਐਜ਼ ਫਾਇਰਫਾਕਸ ਸੈਫਾਰੀ ਓਪੇਰਾ
ਸਮਰਥਨ ਸਮਰਥਨ ਸਮਰਥਨ ਸਮਰਥਨ ਸਮਰਥਨ