-2
目前,我有一個帶有輸入的選擇框列表,我希望在發送表單時將值保存在對象中,像這樣?我怎麼能解決這個問題?保存對象中的字段值
var commissions = {
seller:"Agent",
percentage:"50"
},
{
seller:"Crisalix Global",
percentage:"20"
},
{
seller:"Support",
percentage:"30"
};
這是HTML:
所有的<div class="container-seller-commission">
<div class="row-seller-commission">
<select name="seller" id="seller" class="select-seller valid">
<option value=""></option>
<option value="4" selected="selected">Agent</option>
<option value="2">Crisalix Global</option>
<option value="1">Owner</option>
<option value="3">Support</option>
</select>
<input name="percentage" id="percentage" value="100" class="sales-form-input--number sales-form-input--commission valid" type="number">
</div>
</div>
<div class="row-seller-commission">
<select name="seller" id="seller" class="select-seller valid">
<option value=""></option>
<option value="4" disabled="disabled">Agent</option>
<option value="2" selected="selected">Crisalix Global</option>
<option value="1">Owner</option>
<option value="3">Support</option>
</select>
<input name="percentage" id="percentage" value="100" class="sales-form-input--number sales-form-input--commission valid" type="number">
</div>
<div class="row-seller-commission">
<select name="seller" id="seller" class="select-seller valid">
<option value=""></option>
<option value="4" disabled="disabled">Agent</option>
<option value="2">Crisalix Global</option>
<option value="1" selected="selected">Owner</option>
<option value="3" disabled="disabled">Support</option>
</select>
<input name="percentage" id="percentage" value="100" class="sales-form-input--number sales-form-input--commission valid" type="number">
</div>
你到底在幹什麼? – Liam
如何在問題中說明保存對象中的所有值。謝謝 – user1937021
Aside - ID必須是獨一無二的所有選擇和所有輸入具有相同的ID ...這可能會導致你與JS代碼 – DaniP