Long story short - I'm displaying stock trades table and trying to set table row colors red or green meaning it's 'buy' or 'sell'.
<table border="1" class="dataframe"> <thead> <tr style="text-align: right;"> <th></th> <th>board</th> <th>buysell</th> <th>openinterest</th> <th>price</th> <th>quantity</th> <th>seccode</th> <th>secid</th> <th>time</th> <th>tradeno</th> </tr> </thead> <tbody> <tr> <th>1</th> <td>FUT</td> <td>B</td> <td>2912686</td> <td>67686</td> <td>100</td> <td>SiZ5</td> <td>3630</td> <td>23.09.2015 11:12:27</td> <td>1239572664</td> </tr> ...etc
using jQuery:
$("tr:contains('B')").addClass('greenBg'); $("tr:contains('S')").addClass('redBg'); but it actually colors row based on all content.
So, how should I address it to check only 'buysell' cell value ('B' to greenBg, 'S' to redBg) and set color to the whole row, not only first cell?
Thanks in advance!