```
jQuery ( function ( $ ) {   

    var textarea = $('.project');
    var $counter = $('.chars');

    var limit = 200;
    var initial = 0;

    $(textarea).on('keypress keyup copy paste', function(){
        displayLength();
    });

function displayLength() {
     var thisChars = textarea.val().replace(/(\r\n|\n|\r)/g, '').length; 

    if (thisChars > limit) {
        //$counter.text(thisChars + ' of 200 chars');
        var CharsToDel = (thisChars-limit); 

         textarea.val() = textarea.val().substring(0,textarea.val().length-CharsToDel);

    } else {
        $counter.text(initial + thisChars +' of 200 chars 2');

    }
}
    displayLength();

    });

```

The issue is that it calculates chars incorrectly. if limit is 200, it should be cut (with substring) to 200 chars instead of printing 201 chars. why?

**Update**
Managed to get it working, thanks everybody

Help is appreciated!