Is there a SelectedIndex for an HTML5 DataList?

后端 未结 5 1765
情深已故
情深已故 2021-02-20 03:21

You can pick the current option of any select element:

mySelect.options[mySelect.selectedIndex]

Can I do the same wit

5条回答
  •  孤街浪徒
    2021-02-20 04:25

    Lets say you have data attributes in the above example like this,

    
    
        
    

    and you want to obtain the data-company attribute of the selected item,

    using the loop above

    for (var i=0;i

提交回复
热议问题