Forum Discussion
Limiting Text Entry to One Character
Hi Selma,
I was able to do it but only using Javascript. There may be a better way by now. I had to define each letter in the puzzle as a variable. Then set the max length for that variable to 1. Here is a link to my puzzle. https://carolinatigerrescue.org/wp-content/games/crossword/story_html5.html
It would be enhanced by adding a popup to say you can only add one character, if you try to enter more than one. Or simply replacing the last character entered. But I'm not goof enough with scripting for that on my own.
- DawnFriedel-9bd5 years agoCommunity Member
Here is just a snippet of the code I used.
var fields = "1DownLetter1";
(function setMaxChars(fields) {
fields.forEach(function (field, field_index) {
$('[placeholder=' + field + ']').attr('id',field);
$("#1DownLetter1").attr("maxlength","1");
$('[placeholder=' + field + ']').attr('placeholder', '');
});
})(fields);- 0555331405553315 years agoCommunity Member
HelloDawn Can you help me, how can I apply this? I've been trying this code by Execute Javascript trigger when timeline starts, but it's not working.
- vv-ae7e971a-2793 years agoCommunity Member
Can You Share the Source File?
- StevenBenassi3 years agoStaff
Hi v v!
I just wanted to pop in and share that since this discussion is a bit older, Dawn may no longer be subscribed.
If you wanted to reach out to them directly, you can do so by clicking on their name and selecting the 'Contact Me' link.
Have a great start to your week!
- vv-ae7e971a-2793 years agoCommunity Member
ok Thank You Bro
Related Content
- 11 months ago
- 8 months ago