Before starting this theme, first look at an HTML DEMO, a very simple selection list (SELECT):
Please think about it, if these data (one / two / three) is requested from the background and dynamically add rendering to the DOM system, you can’t determine the index number of each list item, which means There is no ID of these list items. Obviously, we need to get the list item selected by the user and the index number (ID) of the current list item.
The SelectedIndex property sets or returns the index number of the selected option in the drop-down list. If you allow multiple options, you only return the first index number of the selected option.
// Get the indectelem.selected index // Reset index number (newIndex is new) SelectElem
Obtaining an index / reset index
Get the index number
Give you the search number of the selected item in the JS Retrieval drop-down list box, I hope to help everyone. If you have any questions, please leave a message, the small package will reply to everyone. Thank you very much for your support of Tumi Cloud Website!
If you think this article helps you help you, welcome to reprint, please indicate the source,Thanks!