Forum Discussion
Limiting Text Entry to One Character Issue
Hello everybody!
As I work on a crossword puzzle, I would like to limit the text entry fields to only contain one character.
Previously, in 2023, I have succeeded doing it using the JavaScript code down below, and it worked perfectly. Yet, when I tried to use it again, it doesn't seem to be working. Even when I opened my old project from 2023 and republished it again as a test or previewed in storyline it doesn't work anymore either.
I'm wondering if this is happening because there's some issue with storyline, maybe it has to be done differently now? Does anyone have an idea or have met and overcome the same issue?
Thanks.
Here's the JavaScript code somebody here suggested, that I used in my previous projects :
var elements = document.getElementsByTagName("input");
for (var i = 0, element; element = elements[i++];) {
element.setAttribute('maxlength', 1);
element.setAttribute('autocomplete', 'off');
}