Answered How to give red color for rows on html table that have different values on same row?

ahmedsalah

Active member
Joined
Sep 26, 2018
Messages
32
Programming Experience
3-5
How to give red color for rows on html table that have different values on same row ?

I work on dynamic table not static get from back end asp.net sample below for explain idea .
I need when at least one cell from row different from each others

then give red font to full row

if you see below row that have same value on all cell not changed color .

I need function give red color for row that have at least one value different from others on same row

so How to make function do that by jquery or java script do red color for row if it have

at least different cell value .

rows have different values give red rows font
HTML:
<!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>
 
Last edited by a moderator:
so How to make function do that by jquery or java script do red color for row if it have
If you want to do this via jQuery or JavaScript, why are you posting a question in a C# forum? Even if the subforum is ASP.NET, asking about jQuery or JavaScript is like going to a Tesla dealership and asking about spark plugs.
 
so How to make function do that by jquery or java script do red color for row if it have

Before you get into that, I'd replace your dated tables and use HTML 5 with modern CSS techniques, such as using flex blocks instead. Replace your HTML tables with divs. I can understand if you are using tabular data, you'd use a table, but this is nothing you can't do with modern code; thus makes the use of tables irrelevant. They're also not very mobile friendly.
 
Back
Top Bottom