Jump to content

[jQuery] Characters count ignoring new lines

- - - - -

  • Please log in to reply
No replies to this topic

#1
Alhazred

Alhazred

    Learning Programmer

  • Members
  • PipPipPip
  • 99 posts
I need to count the number of characters contained into a textarea while I write.
This is how I do, but it also counts the new line characters
$(document).ready(function(){
    $('#testo').keyup(function() {
        $len=$('#testo').val().length;
        $('#counter').text($len)
    });
});
how do I have to modify this code to don't count the new lines?




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users