JSFiddle - React, Tailwind, and code Playground

by dactivo

HTML

<div id="content">
<span class="foo">7</span> 
<span class="foo">2</span> 
<span class="foo">9</span> 
</div>

CSS

.highest{
color:red
}
.lowest{
color:green
}
.medium{
color:orange
}

JavaScript

$('.foo').filter(function(index) {
  return parseInt($(this).text())>7
}).addClass("highest").filter(function(index) {
  return parseInt(($(this).text())>4 && parseInt(($(this).text())<=7
}).addClass("medium").filter(function(index) {
  return parseInt($(this).text())<=4
}).addClass("lowest")