BvilleBullet BvilleBullet - 7 months ago 37
CSS Question

jquery highlight row based on column value

Hi I am hoping that somebody can help me to tweak this JQuery code so that it will highlight the entire data row rather than just the cell containing the value 'N'. I have tried to apply the code to the table row but it is still only highlighting the background color of the cell containing the value of 'N' where as I need to highlight the entire table row. Does anybody have any suggestions?

<script type="text/javascript"
<script type="text/javascript">

$('#table_id tr.y_n td').each(function(){
if ($(this).text() == 'N') {


<table id="table_id">
<tr><td>I am me.</td><td>Y</td></tr>
<tr class="y_n"><td>N</td><td>Y</td></tr>
<tr><td>I am not sure.</td><td class="y_n">Y</td></tr>
<tr><td>This is a table.</td><td class="y_n">Y</td></tr>


Answer Source

I believe parent() is what you want. Change the following line:



Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download