editable.js icon indicating copy to clipboard operation
editable.js copied to clipboard

Feature: Prevent user from typing in input at max value

Open taejs opened this issue 4 years ago • 1 comments

Is it possible to prevent typing conditionally? I'd like to implement a max-length feature of textarea element using editable.js.

taejs avatar Jan 13 '22 01:01 taejs

No, that's not possible at the moment. You could try setting up a beforeinput event handler on the dom element. That one bubbles up and is cancelable.

But what we're usually doing is to extract the length and then show some warning if the value is above the limit. This results in a better behavior as it won't just cut off characters and also works the with copy/paste of text. Controlling the user input is too complicated most times. image

marcbachmann avatar Feb 19 '22 14:02 marcbachmann