Set row background to blue if Column text is Close

by Mukesh Yadav

HTML

<script src="//code.jquery.com/jquery-1.12.3.min.js"></script>
<table class="table table-bordered" id="depcattableid">
    <thead>
        <tr class="alert alert-warning">
            <th>CreatedBy</th>
            <th>Createddate</th>
            <th>Status</th>
            <th>Options</th>
        </tr>
    </thead>
    <tbody class="tablesorter-infoOnly">
        
            <tr>
                <td>1</td>
                <td>1</td>
                <td>Close</td>
                <td>1</td>
            </tr>
            <tr>
                <td>2</td>
                <td>2</td>
                <td>Open</td>
                <td>2</td>
            </tr>
            <tr>
                <td>3</td>
                <td>3</td>
                <td>Close</td>
                <td>3</td>
            </tr>
    </tbody>
</table>

JavaScript

$("#depcattableid tr").each(function () {
  var status = $(this).find("td:eq(2)").html();
  console.log(status);

  if (status == "Close") {
    $(this).css("background-color", "blue")
  }
});