i am finding span text throughout table using below code. i have to find span text for current tr and background that tr with yellow
$("#tableAppointment tr").each(function ()
{
$('td', this).each(function ()
{
var value = $(this).find("span").text();
if (!value)
{
} else
{
$(this).parent().prev('tr').css('background', 'yellow');
}
})
})
return false;
});
<table id="tableAppointment" cellspacing="1" width="50%" bgcolor="#cccccc" align="center">
<thead>
<tr>
<td bgcolor="#ffffff" width="70px">
</td>
<td class="csstablelisttd" width="70px">
<b>Time Slot </b>
</td>
<td class="csstablelisttd">
<b> Patient Name</b>
</td>
</tr>
</thead>
<tbody>
<tr>
<td class="csstablelisttd" valign="top" width="70px">
8:00AM
</td>
<td class="csstablelisttd">
0
</td>
<td class="csstablelisttd">
<span></span>
</td>
</tr>
<tr>
<td class="csstablelisttd">
</td>
<td class="csstablelisttd">
15
</td>
<td class="csstablelisttd">
<span></span>
</td>
</tr>
<tr>
<td class="csstablelisttd">
</td>
<td class="csstablelisttd">
30
</td>
<td class="csstablelisttd">
<span></span>
</td>
</tr>
<tr>
<td class="csstablelisttd">
</td>
<td class="csstablelisttd">
45
</td>
<td class="csstablelisttd">
<span></span>
</td>
</tr></tbody>
</table>