Please see my code so far (jsfiddle).
I am trying to change the color of the progress bar once it reaches max capacity.
How can I accomplish this?
HTML code:
<textarea></textarea>
<span id="characters">255 left</span>
<br>
<progress id="myProgress" value="0" max="255">
</progress>
JS code:
$('textarea').keyup(updateCount);
$('textarea').keydown(updateCount);
function updateCount() {
var max = 255;
var cs = $(this).val().length;
document.getElementById("characters").innerHTML= max-cs + " left..";
document.getElementById("myProgress").value = cs;
if (event.which < 0x20) {
return;
}
if (cs == max) {
event.preventDefault();
// make the color of progress bar red here!!
}
}