jq获取select控件的selected属性值

邓阳伯
2023-12-01
<select>
	<option value ="3">请选择</option>
	<option value ="0">场内申报</option>
	<option value ="1">场外申报</option>
</select>

if(res.data.type == 0){
	$("select option[value='0']").attr("selected",true);
	$(".intra-field").html('场内');
}else{
	$("select option[value='1']").attr("selected",true);
	$(".intra-field").html('场外');
}

$("select optionvalue='xx']").attr("selected",true);



 类似资料: