var myselect=$("#test option").length; alert(myselect); for(var i=0;i var myselect=$("#test option").length; alert(myselect); for(var i=0;i

Home >Java >javaTutorial >How to get the value of drop-down box option?

How to get the value of drop-down box option?

PHP中文网
PHP中文网Original
2017-06-21 09:16:545013browse

Get the value in option:

(2)
var selectlength = $("#type option").length;
alert(selectlength);
for(var i = 0; i {
alert($("#type option").get(i).value);
if($("#type option"). get(i).value == d.TYPE_ID) //Compare the value of the option with the value in json. If they are equal, set this value as the default selected item
{
//var select =document.getElementById("type");
//alert(sel.options[select.selectedIndex].text);
//var aa=$("#type option").get(i) ;
//$("#type option[value='"+ d.TYPE_ID +"']").attr('selected',true);
//alert("selected"+$ ("#type").find("option:selected").text());
$('#type').combobox('select',d.TYPE_ID); // Set the list in easyUI Display value

}
}

The above is the detailed content of How to get the value of drop-down box option?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn