Search code examples
htmlcontenteditable

How to make HTML5 contenteditable div allowing only text in firefox?


I want to make div with contentEditable attribute which is allowing only text. It's easily achievable in Chrome by using:

<div contenteditable="plaintext-only"></div>

However it doesn't work in Firefox. Is there a way how to make text-only contenteditable div in Firefox ? I know it is possible, because Google Plus has such div, but I don't know how they do it.


Solution

  • Sadly, you can’t. As this answer points out the spec only specifies true, false and inherit as valid parameters. The subject seems to have been discussed but if I’m not mistaken only Webkit implements support for plaintext-only.