One issue I am facing involves changing the style of a specific element within a table cell using jQuery. The change needs to be based on the value in another cell. Below is the table structure:
<table id="table">
<tr>
<td>
<a href="www.google.pl">YYYYYYYYY</a></td>
<td>HHHHHHH<td>
</tr>
<tr>
<td>Jedi Armor1</td>
<td>HHHHHHH</td>
</tr>
<tr>
<td>Jedi Armor2</td>
<td>HHHHHHH</td>
</tr>
</table>
Here is the jQuery code snippet:
$(document).ready(function() {
$('#table tr td').each(function(){
var textValue = $(this).text();
if(textValue == 'HHHHHHH'){
// add css class or any manipulation to your dom.
$(this).parent().css('color','red');
$(this).parent().children('td a').css('color','red');
};
});
// end of hover function
});
The challenge lies in how to modify the style of the specified element.