Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何让 javascript 或 jquery 在表单的选择区域中选择某个选项?使用 jquery 的 .attr/.prop?
$("#idOfElement").val("DesiredValue");
在我看来很简单
$('select option:eq(X)').attr('selected',true);
将 X 替换为所需的:
http://jsfiddle.net/4jBfs/1/