向下拉菜單中添加新選項的最佳方式是什麼,並使其成爲不可選列表中的第一個選項?不可選擇的選項值
所以名單應該是這樣的:
<select onchange="document.getElementById('product_configure_form').action = 'http://webshop.com/product/options/3603848/'; document.getElementById('product_configure_form').submit();" id="product_configure_option_22853" name="option[22853]">
<option selected="selected" value="78619">Choose a size</option> // this is the new not selectable option
<option selected="selected" value="78619">S</option>
<option value="78620">M</option>
<option value="78621">L</option>
</select>
我知道如何與增加一個選項:
$('#product_configure_option_22853').append('<option value="Choose" selected="selected">{{ 'select your size' | t }}</option>');
但是我怎麼讓它不選擇和第一就行了?
任何幫助非常感謝!
小提琴請... –