我一直試圖根據以下鏈接爲表單創建「全選」複選框,但我不斷收到錯誤。我搜查了,但沒有運氣搞清楚這一點。我不確定是否有選擇器正確設置。任何幫助將非常感激!選中所有帶有文本鏈接的複選框:錯誤
Select all checkboxes with a text link
形式
<li id='field_1_17' class='gfield gfield_html gfield_html_formatted gfield_no_follows_desc' >
<a href="#' id="checkall">Select all checkboxes</a>
</li>
<li id='field_1_12' class='gfield' >
<label class='gfield_label'>Wednesday 1/22</label>
<div class='ginput_container'>
<ul class='gfield_checkbox' id='input_1_12'>
<li class='gchoice_12_1'>
<input name='input_12.1' type='checkbox' value='2:30-2:40 Welcome and introduction' id='choice_12_1' tabindex='11' />
<label for='choice_12_1'>2:30-2:40 Welcome and introduction</label></li>
腳本從其他崗位
<script type="text/javascript">
$(function() {
$('#checkall').click(function() {
var checked = $(this).data('checked');
$('input_1_12').find(':checkbox').attr('checked', !checked);
$(this).data('checked', !checked);
});
});
</script>
你正在得到什麼錯誤? – talemyn
沒有這個代碼的錯誤,只是沒有得到檢查 – Sam1600