Checkbox implementation for all checkboxes


#1

I am trying to implement a checkbox to select all chekboxes with one click here. https://jsfiddle.net/wd9v8e7t/
Unfortunately, I couldn’t achieve it. Can an jquery expert help me, please? The individual checkoxes work fine, but the “SelectAll” checkbox for all tables at the top doesn’t work. Thanks.


#2

https://jsfiddle.net/wd9v8e7t/5/


#3

thanks, astonecipher. Your code selects all, but doesn’t highlight the tables. isn’t it supposed to highlight at the same time?


#4

That wasn’t mentioned. For that to happen, you just need to trigger the event that the other functions use to toggle the class,

$('input:checkbox').not(this).prop('checked', this.checked) .trigger("change");
Rather than just the property change.

https://jsfiddle.net/wd9v8e7t/8/


#5

I am sorry, it is my ignorance, I just assume that if it’s checked, it should highlight automatically. thanks a lot, I will check your code, and implement it on my page.