Binding two checkboxes together

后端 未结 3 471
粉色の甜心
粉色の甜心 2021-01-14 23:01

I have two checkboxes

 

and



        
3条回答
  •  春和景丽
    2021-01-14 23:50

    You can bind a change event handler on the checkboxes and based on the value of the changed checkbox, set the value of other checkboxes.

    $(function() {
    
      $(".checkbox_class").change(function() {
    
        var x = this.checked;
        $(".checkbox_class").prop("checked", x);
    
    
      });
    });
    
    
    
    

提交回复
热议问题