You need just innerHTML/innerText
method and set of conditions. No jQuery needed.
var el = document.getElementById('polIndice');
var val = parseInt(el.innerText);
var class_name;
if (val < 50) {
class_name="indiceLow";
} else if (val < 100) {
class_name="indiceMedium";
} else {
class_name="indiceHigh";
}
el.className += ' ' + class_name;
1
solved JS condition change class