Character count - Java Script

Hello everyone, I'm writing a course/slide that requires the user to write a short response.  For SCORM 1.2 and Moodle LMS reasons we're capped at 256 characters.  SL's meets our needs by capping their responses.  However,  I thought it would be a nice touch to add a character/keystroke counter to let the users know when they were getting closer to their limit.

sort of like this:

I know that variables exist (my experiment is attached), it works but its messy and error prone.

I think it's possible to make a cleaner more professional version using Java Scripting, I'm just not versed egnough to make it work.  Here's an example of the code that should work??

Can this be done in Storyline?

Am I barking up the wrong tree with JS?

3 Replies
Phil Mayor

I built this for someone else but should help you out

This will only count after they have submitted until that point the variable does not exist so cannot be sent to javascript, so probably wont work for you.

I do not know of any issues with Moodle and character length, and for scorm the variable data is compressed.  You could try using the short answer question which I think is limited to 256 characters