jquery使页面中所有select选中第一个option,就是重置的功能,怎么实现呢?

("select").find("selected",'0'option[index=']").attr("selected');我这么写没反应啊

第1个回答  2019-06-19
//方法一,支持低版本的jquery.js
var
a
=
document.getElementById("mySelect");//mySelect是select
的Id
a.options[0].selected
=
true;
//方法二,jquery1.6中新加了一个方法prop(),因此使用prop()时请使用jquery1.6及以上版本
$("#mySelect
option:first").prop("selected",
'selected');
相似回答
大家正在搜