<thead>
<tr>
<th>Num</th>
<th>name</th>
<th>date</th>
<th><input type="checkbox" name="m_check" id="m_check" /></th>
</tr>
</thead>
<tbody>
<!-- i have loop for get data -->
<tr>
<td>$Num</td>
<td>$name</td>
<td>$date</td>
<td><input type="checkbox" name="e_check[]" value="<?php echo $companys->data[$i]['com_id'] ?>" class ="e_check" id="e_check_<?php echo $companys->data[$i]['com_id'] ?>" /></td>
</tr>
<!-- end loop for get data -->
</tbody>
這是我的腳本
$('#m_check').change('change',function() {
if ($(this).is(':checked')) {
$('input[name="e_check[]"]:checkbox').attr('checked', true);
$('#ib_email').removeAttr("disabled");
} else {
$('input[name="e_check[]"]:checkbox').attr('checked', false);
$('#ib_email').attr("disabled", "disabled");
}
});
我的問題是我需要的時候用戶就m_check
檢查它的e_check
但檢查檢查元素只有10個,如果我的e_check
還有10多個。
請幫我糾正我的js
我也看到this,但我仍然不能自定義我的代碼:(
**確認我的代碼是沒有錯的用戶檢查了所有,這是檢查牙齒列所有,未經檢查和它是否被選中的所有元素行,但是當用戶檢查所有的按鈕它檢查元素行的限制,10排頂等仍然沒有檢查
代替'$( '#m_check')。改變( '變',函數(){'和'$( '#m_check')。在( '變', '#m_check',函數( ){' – Umair
http://jsfiddle.net/tm6SH/56/ –
@Learner謝謝:) – Songs