I want to get select a selected value, or text, or ......
For example, this:
<SELECT ID = "SELECT">
<Option value = "A" URL = "http://www.baidu.com"> First Option </ Option>
<Option value = "B" URL = "HTTP: / /www.qq.com "> second Option </ Option>
</ SELECT>
a: JavaScript native methods
1: get select objects: `var myselect = document.getElementById (" select ");
2: get the index of the selected item: var index = myselect.selectedIndex; // selectedIndex represents your selected item index
3: Select the item options to get the value: myselect.options [index] .value;
4: get the text of the selected entry options: myselect.options [index] .text;
5: get the values of other selected item, such as where the url: myselect.options [index] .getAttribute ( ' url');
two: jQuery Method
1: var options = $ ( "# select option: selected"); // get the selected item
2: alert (options.val ()); // get the value of the selected item
3: alert (options.text ()); // get the text of the selected item
4: alert (options.attr ( 'url')); url // get the value of the selected item