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
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
Why that way
It changes nothing tho
I did it that way to check if there is some value
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
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