var selectVal = $(this).val();
$("#ipinfo").text(selectVal);
//第一种$("#s0").find("option[text='"+($(this).val())+"']").attr("selected", "selected");
//第二种
$("#s0 option").each(function(){
if($(this).text() == selectVal){
$(this).attr({"selected":true});
//$(this).text(selectVal);
// alert($(this).text());
// alert(selectVal);
}else{
$(this).attr({"selected":false});
}
});
select通过text的值来进行选定来进行
最新推荐文章于 2023-02-24 11:36:16 发布