samedi 20 septembre 2014

jQuery filter through range of text and apply a new bg color


Vote count:

0




I want to use jquery to search for a text range in the .sos cell and change the bg color based on the value of the range set.



text value 1-6 = green
text value 7-12 = blue
text value 13-20 = yellow
text value 21-26 = pink
text value 21-26 = black
then also if no text value matched set a different color or purple


example html



<td class="sos">11</td>
<td class="sos">2</td>
<td class="sos">32</td>
<td class="sos">3</td>


I know how to do each text value 1 at a time , but haven't seen any tuts to do a range , if possible.



$('.sos').each(function () {
if ($(this).text() == '3') {
$(this).css('background', 'red');
}
});


asked 35 secs ago

MShack

189






jQuery filter through range of text and apply a new bg color

Aucun commentaire:

Enregistrer un commentaire