0
我有下面的表格,其中的複選框將比較每行中最多3個項目進行比較。添加數字到複選框的屬性和限制選中的複選框的數量
所以我想要一些jQuery,只允許選擇3個複選框,然後它會動態地添加一個數字到名稱屬性的末尾。
所以如果有2個比較,名稱屬性將是「horse_1」和「horse_2」。
我不知道從哪裏開始!
<tr>
<td><input type="checkbox" value="2560092" name="horse_"></td>
<td>1</td>
</tr>
<tr>
<td><input type="checkbox" value="2560093" name="horse_"></td>
<td>2</td>
</tr>
<tr>
<td><input type="checkbox" value="2560094" name="horse_"></td>
<td>3</td>
</tr>
<tr>
<td><input type="checkbox" value="2560095" name="horse_"></td>
<td>4</td>
</tr>
開始通過聽取'change'事件。 – undefined 2014-10-30 06:37:37
您想要限制用戶可以從可用複選框中選擇任意三個複選框的用戶界面..正確..? – 2014-10-30 06:38:31
當他們點擊時會發生什麼?它沒有得到檢查,或者它是否應該通過取消選擇第一項來循環選擇? – Snellface 2014-10-30 07:15:04