In my application I am in need to set different background color to table row based on similar td value which is dynamic data. I tried to achieve this but I was unable to group the table row with different background color. I have attached the expected result screen-cap along with the fiddle link.
[fiddle](https://jsfiddle.net/t5ft82z2/21/)

**HTML CODE**

```
<table>
    <tr>
        <th>roll</th>
        <th>name</th>
        <th>Random number</th>
    </tr>
    <tr>
        <td>1</td>
        <td>Name 1</td>
        <td>73023-04041</td>
    </tr>
    <tr>
        <td>2</td>
        <td>Name 2</td>
        <td><span>73023-04042</span></td></td>
    </tr>
    <tr>
        <td>3</td>
        <td>Name 3</td>
        <td><span>73023-04040</span></td>
    </tr>
    <tr>
        <td>4</td>
        <td>Name 4</td>
        <td><span>73023-04042</span></td>
    </tr>
    <tr>
        <td>5</td>
        <td>Name 5</td>
        <td><span>73023-04041</span></td>
    </tr>
</table>

```

**JS CODE**

```
$("table tr td:nth-child(2)").each(function () {
    var tdVal = $(this).children().find("span").text();
    var valueColor = $(this).children().find("span").text();
    if (valueColor == tdVal) {
        //alert("if");
        $(this).parent("tr").addClass("trColor");
    }
});

```

**Expected Result**

[![Expected Result](https://i.stack.imgur.com/nh834.png)](https://i.stack.imgur.com/nh834.png)