I wrote a jQuery character counter, it works when I type, but not when text is pasted. The function is executed upon paste, but count doesn't change. I am not sure if val() function is correct or really in synch with 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);
bind()as a string with each event separated by a space$('#selector').bind('click mouseover', function(){} )