Thanks for your accurate remark.

I came up with adding some event but I don't know which. Focus doesn't
work as I want to. It doesn't update counter immediately after pasting
text. Until after "leaving" input. Just as focus event works.

Some other ideas?

On 12 Cze, 14:35, MorningZ <morni...@gmail.com> wrote:
> "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

Reply via email to