jquery怎么根据一个值来选中select下的option

发布时间:2019-08-07 18:58:15

我的js
alert(habBefore) ;能得出正确值 0或1、2、3
$(this).children("option[value='"+habBefore+"']").attr("selected",true) ;火狐不报错但没什么反应
alert($(this).children("option[value='"+habBefore+"']").val()) ;出现undefined
this是代表着select,option的个数不一定 3或4个。
所以想问下怎么弄

推荐回答

还没有选出推荐答案,请稍候访问或查看其他回答!
以上问题属网友观点,不代表本站立场,仅供参考!