0
嗨我已經看到了循環的基本知識,但是,當循環訪問特定複選框時,除了下面的基本循環功能外,還將在jQuery代碼中添加什麼內容?就像我可以用什麼來特別循環一組複選框。謝謝。我在下面添加了複選框的HTML格式。通過一組特定的文本框循環訪問
$("A").each(function(index) { console.log(index + ": " + $(this).text()); });
<td class="dot_wrap">
<label for="A1"><span class="hidden">A-1</span>
<input type="checkbox" value="A1" name="A1" id="A1" tabindex="1" class="A">
<span aria-hidden="true"> </span>
</label>
</td>
<td class="dot_wrap">
<label for="A4"><span class="hidden">A-4</span>
<input type="checkbox" value="A4" name="A4" id="A4" tabindex="4" class="A">
<span aria-hidden="true"> </span>
</label>
</td>
<td class="dot_wrap">
<label for="A2"><span class="hidden">A-2</span>
<input type="checkbox" value="A2" name="A2" id="A2" tabindex="2" class="A">
<span aria-hidden="true"> </span>
</label>
</td>
<td class="dot_wrap">
<label for="A5"><span class="hidden">A-5</span>
<input type="checkbox" value="A5" name="A5" id="A5" tabindex="5" class="A">
<span aria-hidden="true"> </span>
</label>
</td>
<td class="dot_wrap">
<label for="A3"><span class="hidden">A-3</span>
<input type="checkbox" value="A3" name="A3" id="A3" tabindex="3" class="A">
<span aria-hidden="true"> </span>
</label>
</td>
<td class="dot_wrap">
<label for="A6"><span class="hidden">A-6</span>
<input type="checkbox" value="A6" name="A6" id="A6" tabindex="6" class="A">
<span aria-hidden="true"> </span>
</label>
</td>
在選擇器中添加點以使其按類選擇:'$(「.A」)' – trincot