I have created a script to count characters of a textarea
in JavaScript, the code is this:
<div>
<p class="texto-cont">Restam <span id="cont">2.200</span> caracteres</p>
</div>
function limite_textarea(valor) {
quant = 2200;
total = valor.length;
if(total <= quant) {
resto = quant - total;
document.getElementById("cont").innerHTML = resto;
} else {
document.getElementById("texto").value = valor.substr(0,quant);
}
}
I need to change the background
of the excerpt "2,200 characters remaining" . When you are in 2,200, you would like the background
to be green, orange in 2000, and red in 100 characters.