0

I am trying to make one checkbox select when the other one is selected. This is what I have come up with:

    <script>
                                    $(document).ready(function(){

                                    var chk1 = $("input[type='checkbox'][name='notify']");
                                    var chk2 = $("input[type='checkbox'][name='notify_comments']");

                                    chk1.on('change', function() {
                                        chk2.prop('checked', this.checked);
                                    }
                                    });
                                </script>

<input type="checkbox" name="notify">
<input type="checkbox" name="notify_comments">
Sackling
  • 1,780
  • 5
  • 37
  • 71

0 Answers0