I want to limit the number of words a person can enter in a text field. How can I track the number of words (by using a second field) in that field as each word is entered?
A:
Ichorus
2008-10-15 22:07:03
+1
A:
use this js (using jquery):
$('#newKeywords').bind('change', function() {
$('#wordsLong').text($('#newKeywords').val().split(' ').length + 1);
});
and this html:
<textarea id="newKeywords"></textarea>
<div>The text consists of <span id="wordsLong"></span> keywords.</div>
henchman
2010-03-09 11:22:32