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!