I want to set a option that was selected previously to be displayed on page load.
(我想设置一个先前选择的选项,以便在页面加载时显示。)
I tried it with the following code: (我用以下代码尝试了它:)
$("#gate").val('Gateway 2');
with
(同)
<select id="gate">
<option value='null'>- choose -</option>
<option value='gateway_1'>Gateway 1</option>
<option value='gateway_2'>Gateway 2</option>
</select>
But this does not work.
(但这不起作用。)
Any ideas? (有任何想法吗?)
ask by Upvote translate from so 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…