When creating a cross-browser rich text editor. Which would you use and why?
Keep in mind that pasting has to be resilient to stand against multiple sources (notepad, word, other websites) and it should not be dependent on any Javascript libraries.
If the input should be editable by user, you should use this. Its totally on the client side, means that on browser side. Of course you should secure the value if its going to be sent to you server database.
The contenteditable global attribute is an enumerated attribute indicating if the element should be editable by the user. If so, the browser modifies its widget to allow editing.
Answer: Use the HTML5 contenteditable Attribute You can set the HTML5 contenteditable attribute with the value true (i.e. contentEditable="true" ) to make an element editable in HTML, such as <div> or <p> element.
You probably want contentEditable. designMode applies to the document, contentEditable to a specific element and its children.
http://blog.whatwg.org/the-road-to-html-5-contenteditable
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With