Home >Web Front-end >JS Tutorial >The val() method in jquery reads from the last option forward_jquery
In jquery, the val() method reads forward from the last option. If any of the value or text of the option matches, it will be selected
<select id="single"> <option>选择1号</option> <option>选择2号</option> <option value="选择2号">选择3号</option> </select> $("input:eq(0)").click(function(){ $("#single").val("选择2号"); });
So the 3rd option was finally chosen!