jquery 全选、全不选checkbox

html:

<label><input type='checkbox' class='hospital_sel_ckbox' value='888' />A医院</label>
<pre name="code" class="html"><label><input type='checkbox' class='hospital_sel_ckbox' value='999' /><span style="font-family: Arial, Helvetica, sans-serif;">B医院</span><span style="font-family: Arial, Helvetica, sans-serif;"></label></span>

 
 
js:
   function select_all_hospital(sel){
        $('.hospital_sel_ckbox').each(function(){
            $(this)[0].checked = sel ;
        });
    }
<pre name="code" class="javascript"><pre name="code" class="javascript">全选:<span style="font-family: Arial, Helvetica, sans-serif;">select_all_hospital(true);</span>
全不选: select_all_hospital(false);
 
 
 
 

你可能感兴趣的:(js,jquery,checkbox)