Jquery 點擊父類全選子類 , 子類選父類


<p>
   <label style="font-size:18px;font-weight: bold;" class="checkboxs">
      <input type="checkbox" name="faci_in_checkbox[]" value="56" class="">&nbsp;B超          
   </label>
   <span>
        <label style="margin-left:0px;" class="auth_rules">
           <input type="checkbox" name="faci_in_checkbox[]" value="65" class="">腹部B超
        </label>
       <label style="margin-left:0px;" class="auth_rules"><input type="checkbox" name="faci_in_checkbox[]" value="66">甲狀腺B超</label>
       <label class="auth_rules"><input type="checkbox" name="faci_in_checkbox[]" value="76">  的說法士大夫 </label>              
    </span>
</p>

$(".checkboxs").click(function (){
    var is_check = $(this).find('input').get(0).checked; //判斷是否選中
    $(this).next().find('input').prop("checked",is_check);
})
$(".auth_rules").click(function (){
   $(this).parent().parent().children('label').find('input').prop('checked','checked')
})

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM