1

I'm trying to use contenteditable with an onkeydown event which should limit my characters input. However I've stumbled across an issue on mobile where this onkeydown event is not working properly, but it works on desktop.

Can anyone help me with this? I just want a method to limit the characters input in the contenteditable that works on desktop & mobile. At the moment it only works for on desktop.

<div onkeydown="return (this.innerText.length <= 11)" contenteditable="true" onpaste="return false;" placeholder="RUN A AWAY" id="quote__text" class="editable"></div>

If i had to use input, how can i make it expand as the text grows?

1

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.