Skip to main content
Nintex Community Menu Bar

Count words of text area

  • Mar 4, 2018 12:24 PM UTC
  • 3 replies
  • 38 views
  • Translate All

Forum|alt.badge.img+4

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 sad.png

What could be the problem?

3 replies

Forum|alt.badge.img+14
  • Scholar
  • Mar 5, 2018 8:52 AM UTC

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

Translate

Forum|alt.badge.img+9
  • Mar 5, 2018 2:59 PM UTC

Did You see  

Translate

Forum|alt.badge.img+4
  • Author
  • Apr 23, 2018 6:14 AM UTC

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

Translate