Option index attribute

Definition and Usage

index Sets or returns the index position of the option in the dropdown list.

Indexes (indices) start from 0.

See also:

HTML Reference Manual:HTML <option> ট্যাগ

Example

Example 1

Show the index and text of the selected option in the dropdown list:

var x = document.getElementById("mySelect").selectedIndex;
var y = document.getElementById("mySelect").options;
alert("Index: " + y[x].index + " is " + y[x].text);

স্বয়ং প্রয়োগ করুন

Example 2

Show all text and index of options in the dropdown list:

var x = document.getElementById("mySelect");
var txt = "All options: ";
var i;
for (i = 0; i < x.length; i++) {
    txt = txt + "\n" + x.options[i].text + " has index: " + x.options[i].index;
}

স্বয়ং প্রয়োগ করুন

সিনট্যাক্স

index অবজেক্ট ফলাফল দিন:

optionObject.index

index অবজেক্ট সেট করুন:

optionObject.index = integer

প্রতিভূতি

মূল্য বর্ণনা
integer ড্রপডাউন লিস্টের অপশনের ইনডেক্স স্থান নির্দিষ্ট করে

প্রযুক্তিগত বিবরণ

ফলাফল: সংখ্যা, যা ড্রপডাউন লিস্টের অপশনের ইনডেক্স স্থানকে নির্দেশ করে।ইনডেক্স 0 থেকে শুরু হয়。

ব্রাউজার সমর্থন

চ্রোম এজ ফায়ারফক্স স্যাফারি ওপেরা
চ্রোম এজ ফায়ারফক্স স্যাফারি ওপেরা
সমর্থন সমর্থন সমর্থন সমর্থন সমর্থন