The maxlength attribute for input: text doesn't work for mobile devices?

I'm generating <input> tags through js and each input should have a maxlength attribute. It works fine on pc but don't on mobile. I mean, on PC I can only type 1 digit on each input box, but the same doesn't apply on mobile. Why? Codepen: https://codepen.io/leoncelestino/pen/wvObBax
5 Replies
MarkBoots
MarkBoots10mo ago
dont have the time to dive into it too much, but maybe try changing the ifstatement on line 259 to check for the value length
if(inputField[index + 1] && target.value.length === 1 && key){
...
}
if(inputField[index + 1] && target.value.length === 1 && key){
...
}
Pi, a future fluent jp speaker
Why that way It changes nothing tho I did it that way to check if there is some value
MarkBoots
MarkBoots10mo ago
ah okay, i see now. again, i cant dive into it too much. maybe elsewise, instead of a keyup event it might work better on mobile if you use an input event
Pi, a future fluent jp speaker
The keydown events works fine for mobile. What doesn't work on each is backspaces key which is a different problem I'm dealing with on #Key and Code values for "enter" key in mobile
Want results from more Discord servers?
Add your server