problem

How to make row that have different value with color red font to full row ?

I have html dynamic table not static meaning i dont know how many rows or column inside

table because it changed based on data show from back end .

I need to give color red to row have distinct value

according to my case then second row and third row will be

have font red and first row will not be change color .

First row have similar value as 12 on all td so that color will not change .

But second row have distinct value or different value 15 so that will be red font to full

row completely .

third row have distinct value or different value as 17,15,13,12 so that third row

completely will have red font .

meaning if I have one value or more different value from each other on same row

then full row or all td on tr will be change font to red .

Actually i need function jquery or javascript give row that have different value with

color red to full row ?

can you please help me on that ?

<!DOCTYPE html> <html> <body> <table border="1"> <col width="500"> <col width="500"> <col width="500"> <col width="500"> <tr bgcolor="#6699FF" width="100%"> <th>Part1</th> <th>Part2</th> <th>Part3</th> <th>Part4</th> <tr> <td>12</td> <td>12</td> <td>12</td> <td>12</td> </tr> <tr> <td>12</td> <td>15</td> <td>12</td> <td>12</td> </tr> <tr> <td>17</td> <td>15</td> <td>13</td> <td>12</td> </tr> </table> <button id="button">Click Me</button> </body> </html>

Here's something to start with:

$(function() {
    $("table tr").each(function() {
        var tdValues = [];
        $(this).children().each(function() {
            tdValues.push($(this).text());
        });

        // here you can use tdValues to check whether the values contain what you need
        // and assign a style to $(this)
    });
});
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.