cancel
Showing results for 
Search instead for 
Did you mean: 
Workflow Hero

Count words of text area

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?

0 Kudos
Reply
3 Replies
Workflow Hero

Re: Count words of text area

you capture keypress event and then calculate text().length on a document level, not for specific textbox

Accept as Solution Reply
Workflow Hero

Re: Count words of text area

Did You see  

Accept as Solution Reply
Workflow Hero

Re: Count words of text area

The problem was with the defintion of this rextarea to be "richtext"

0 Kudos
Accept as Solution Reply