Is there a SelectedIndex for an HTML5 DataList?

后端 未结 5 1739
情深已故
情深已故 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:01

    You can just add a value to the input element. This will be shown to the user as the "default" value. If the user decides to change it, i.e. delete this value from the input field, then the list in the datalist will show up:

    
    
      
    

提交回复
热议问题