Live character count of essay question box

Apr 11, 2024

I have an essay box with a limit of 1000 characters. I'd like to show (below it) a live character count of - either - characters used or characters remaining (either one, doesn't matter to me).  I initially tried to create a variable to "add value" which would, in theory, add 1 for each character entered and then show that number. But it's not working.  I've included the file for reference.

Is there a way to do this?  Preferably without javascript.  :-)  Thanks!


2 Replies
Nathanial Hilliard

Hi Judy. I don't think you will find a way to do this without some JavaScript.

If you are still interested, I attached an updated version of your story with a working character counter.

I added a small JS snippet on the first slide's timeline start. It finds the email body input box, attaches an event handler which watches the contents of this box, and updates the displayed AAcount variable whenever the contents change.

I disabled the add 1 to AAcount trigger

I added two text variables in SL:

     fnListener (a reference to the event listener)

     refInputBox (a reference to the text input box for the email body)

I added one last snippet of JS on the timeline start of the next slide (after the user successfully submits the form) that removes the event handler that was attached to the input box since we don't need it anymore. It uses both of the new variables to know what needs to be removed.