I'm brushing up on my JS, and I don't know how to ask this, exactly.
I have this:
text_area.onkeyup = function() {
var text_length = this.value.length;
var text_remaining = text_max - text_length;
feed_back.innerHTML = "<strong>" + text_remaining + "</strong> charactres remaining";
}
It works. However, should I be able to take the function and pull it out to something like this?
function countDown() {
var text_length = this.value.length;
var text_remaining = text_max - text_length;
feed_back.innerHTML = "<strong>" + text_remaining + "</strong> charactres remaining";
}
and just call the function by its name?
text_area.onkeyup = countDown();
This has never worked for me, across multiple projects.
Should it? Why doesn't it?