I wrote a jQuery character count, it works when I print, but not when pasting text. The function is executed upon insertion, but the counter does not change. I'm not sure if the function is val()true or really synchronized with the DOM. Any ideas?
counter = function () {
$j("strong#status-field-char-counter").text($j("#Panel1messagesmessage").val().length);
alert('event');
};
$j("textarea").keyup(counter);
$j("textarea").bind('paste', counter);
$j("#Panel1messagesmessage").bind('copy', counter);
$j("#Panel1messagesmessage").bind('delete', counter);
AlexA source
share