Background color selection
I have a problem with this code here:
https://jsfiddle.net/09aue04a/ When I try individual highlighting, it works. but I can't make it work for highlighting "Select all" with different colors.
- $(function () {
- $('.selector').on('click', function(e) {
- var checked = this.name;
- var selectedColor = '';
- if (this.checked) {
- selectedColor = $('#nextColor').val();
- }
- $('td').filter(function() {
- return this.textContent == checked;
- }).css('background-color', selectedColor);
- });
-
- $('.all').on('click', function(e) {
- var checked = this.name;
- var selectedColor = '';
- if (this.checked) {
- selectedColor = $('#nextColor').val();
- }
- $('#form1').find('td').css('background-color', selectedColor);
- });
- });