jQuery选择器:表单选择器

jQuery选择器:表单选择器

$(':checkbox')
选择所有的复选框, 选取类型type为 checkbox 的 <input> 元素。

  

全选与反选功能:

function selectAll(el){
    if(!$('el').attr('checked')){
        $(':checkbox').removeAttr('checked');      
    }else{
        $(':checkbox').attr('checked', true);  
    }
}

  

posted @ 2017-10-11 15:58  AlisonGavin  阅读(184)  评论(0编辑  收藏  举报