Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $('#check-all-parent').click(function(event) {
- if(this.checked) { // check select status
- $('#check-all-child').each(function() { //loop through each checkbox
- this.checked = true; //select all checkboxes with class "checkbox1"
- });
- }else{
- $('#check-all-child').each(function() { //loop through each checkbox
- this.checked = false; //deselect all checkboxes with class "checkbox1"
- });
- }
- });
- <input type="checkbox" id="check-all-parent">hello
- <br />
- <input type="checkbox" id="check-all-child">hello2
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement