insert a div inside a td depending on the value of the td
I have a html snippet generated as below
<td
class
=
"ms-vb2"
>
Amber
</td>
which i want to change into the below if the value is Amber
<td class="ms-vb2">
<div style="font-weight:bold; font-size:24px; font-size:10px; color:white; background-color:#DC630A;">
Amber
</div>
</td>
I am using the below code:
- $( document ).ready(function() {
$('td.ms-vb2').each(function( index ) {
if($( this ).text()== 'Amber'){
$(this).css("background-color","#DC630A");
}
});
});
I want to use the above snippet to make the change.