我在html頁面中有一個選擇輸入字段。如果一個條件應該工作。選擇的選項沒有價值不起作用
<select id='selectopt'>
<option value="">Select<option>
<option value="1">1<option>
</select>
<input type="text" id='text1'>
if($('#text1').val==='name'){
$("#selectopt option[value='']").attr('selected', true);
}
else{
}
,當我把這個情況中,如果其在Chrome和IE,但在Firefox不工作的工作..
爲什麼你需要的JS時,你可以做'<期權價值=「」選擇>選擇
@guradio可能是這個代碼是一些事件處理中? –
@SureshAtta也許除非OP給出額外的信息。我們只能猜測。 – guradio