Forum Discussion
Minimum number of characters required
For text entry, is there a way (maybe with Javascript) to make a user enter a minimum number of characters before they can move on? To prevent them from typing in one character just to click next.
- rajakrishnaCommunity Member
For Text Area:
$('textarea').attr("maxlength",10)
For Input:
$('input').attr("maxlength",10)
- rajakrishnaCommunity Member
This is for Set Maximum Characters Length.
- JeremyStumpCommunity Member
Hi, could you provide an example of how to set the maximum character length? I am having a tough time figuring this out.
- EmmabelAgustinCommunity Member
Hello, how can I apply this? I've been trying this code by Execute Javascript trigger when timeline starts, but it's not working.
- MathNotermans-9Community Member
V Raja's solution requires jQuery. Any Javascript code you see with $ signs in it are using jQuery. And as jQuery is not included anymore in Storyline it wont work as is.
To convert jQuery code to Vanilla Javascript ( Vanilla as it doesnot require any 3rd party libraries like jQuery ) you can use this link.
https://tobiasahlin.com/blog/move-from-jquery-to-vanilla-javascript/ - HanaSedlakovCommunity Member
Hello Matthew,
I wanted to ask if there is already an option to bypass saving the text in a variable, so that I don't have to click outside and can count characters directly as I type? - WaltHamiltonSuper Hero
The short answer is no. A more difficult option might be to capture individual keystrokes and use JS to build up the text. I imagine that would take more work and triggers than it would be worth.