I'm trying to write a function that counts characters in a <textarea>. My current problem is to trigger an alert in my function so I can know I'm on the right track. What do I need to add to my JS to get the alert to work?
<!doctype html>
<html> <head> <title> Counter </title>
<script type="text/javascript">
var maxChar = 251;
var currentNum = 0;
var textarea_that_holds_the_characters_to_count = document.getElementById('ta');
calcCharacters.onkeydown = calcCharacters2;
function count_the_characters_in_the_ta_textarea() {
alert( "I'm gonna count those chars in ta!" );
//calculation of the number of characters in <textarea>;
}
</script>
</head> <body>
<form>
<textarea name="ta" rows="6" style="width:340px;"> </textarea>
<br>
<input type="text" name="countDisplay" size="3" maxlength="3" value="250"> Characters Remaining
</form>
</body> </html>