If I have prefilled textarea, the 250 characters don't actually count the default words already in there. It only starts counting if you start typing something in it.
Also, how do I change the text color to yellow on "100 characters remaining" and change to red on "0 characters remaining"
Can someone help please?
function handle(){
let element = document.getElementById('input')
let value = element.value
let maxLength = element.maxLength
document.getElementById('remaining').innerText = `${maxLength - Number(value.length)} characters remaining`
}
<textarea col="8" rows="8" maxlength='250' onkeyup="handle()" id="input" value="">Hello World. Im born today.</textarea>
<p id='remaining'>250 characters remaining</p>