The example in this article describes how jquery obtains the selected value of select. Share it with everyone for your reference, the details are as follows:
Misunderstanding:
I used to think that jquery gets the text value of the selected option in the select, which is written like this:
It should actually look like this:
$("#s").val(); $("#s option:selected").val();
js gets the value selected by select:
var sel=document.getElementById("select1"); var index = sel.selectedIndex; // 选中索引 albumid= sel.options[index].value;//要的值
I hope this article will be helpful to everyone in jQuery programming.