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?

Teik Cheah
  • 99
  • 10
  • Does this answer your question? [keyup, keydown and keypress events not working on mobile](https://stackoverflow.com/questions/47478453/keyup-keydown-and-keypress-events-not-working-on-mobile) – Anil Parshi Dec 03 '21 at 12:37

0 Answers0