Home > front end >  Native js for the select drop-down box selected values
Native js for the select drop-down box selected values

Time:09-24

Native js method:

Var myselect=document. GetElementById (" test ");

Var index=myselect. SelectedIndex;

Var value=https://bbs.csdn.net/topics/myselect.options [index] value;

Jquery methods:

Var options=$(" # test option: selected ");

Options. Val ();//get the value

The options. The text ();//get the text

  • Related