[jQuery] textarea chars counter

[jQuery] textarea chars counter


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