"But id doesn't work when I click the right mouse button on it and choose "Paste""
And this should be easy as cake to understand: Copy and Paste will *not* fire the "keyup" event which your code is requiring You'll need to wire that event to more events to make it work with C&P (focus would come to mind) On Jun 12, 7:40 am, dreame4 <91drea...@gmail.com> wrote: > Hi, > > I need to count characters in textarea so I wrote sth like this: > > $input.keyup(function() { > var new_length = $(this).val().length; > $word_counter.text(new_length); > if(new_length >= min && new_length <= max) { > $word_counter.addClass('git'); > } else { > $word_counter.removeClass('git'); > } > > }); > > But id doesn't work when I click the right mouse button on it and > choose "Paste". Counter is not updated. > > Can anyone help? > > Thanks, > Adam