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

ahmedsalah

Member
Joined
Sep 26, 2018
Messages
14
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:

Skydiver

Well-known member
Joined
Apr 6, 2019
Messages
922
Location
Virginia Beach, VA
Programming Experience
10+
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.
 

Sheepings

Senior Programmer
Joined
Sep 5, 2018
Messages
844
Location
UK
Programming Experience
10+
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.
 
Top Bottom