jQuery选择器:表单选择器
$(':checkbox') 选择所有的复选框, 选取类型type为 checkbox 的 <input> 元素。
全选与反选功能:
function selectAll(el){ if(!$('el').attr('checked')){ $(':checkbox').removeAttr('checked'); }else{ $(':checkbox').attr('checked', true); } }
jQuery选择器:表单选择器
$(':checkbox') 选择所有的复选框, 选取类型type为 checkbox 的 <input> 元素。
全选与反选功能:
function selectAll(el){ if(!$('el').attr('checked')){ $(':checkbox').removeAttr('checked'); }else{ $(':checkbox').attr('checked', true); } }