
点击1或者2 设置select option 为对应的选中
自己写了一些代码但是不管用
1
2
3
4
$('p').click(function(){
var p = $(this).html();
$('option[name="sb"]').attr('selected',false);
$('option[value="'+p+'"]').attr('selected',true);;
})
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
selectObject.selectedIndex=number
http://www.jb51.net/w3school/...
首先你的js没有用script标签标记,而且你最后面$('option[value="'+p+'"]').attr('selected',true);用了两个分号
这个方法好low