AnsweredAssumed Answered

Count words of text area

Question asked by eyalseg on Mar 4, 2018
Latest reply on Apr 22, 2018 by eyalseg

Hi evryone,

I have used this code:

 

NWF$(document).on('keypress', function (e) {
        var length = NWF$(this).text().length;
        if (length >= notesMaxLength) {
            NWF$counter.text(notesMaxLength + '/' + notesMaxLength);
            NWF$(this).val(NWF$(this).val().substring(0, notesMaxLength));
        } else {
            NWF$counter.text(length + '/' + notesMaxLength);
        }
    });

 

In order to limit the chars of textarea to be 1500 chars, but it not works

What could be the problem?

Outcomes