I heard that the new HTML5 will add rich text capability to textareas (it will make them more flexible), so you can do stuff like code syntax highlighting editors without very nasty javascript (like creating iframes and stuff).
Is this true? Are there browsers with support for it yet? And where can I find some API?
You are correct, it cannot be done. According to MDN, "character data" is the only permitted content for a <textarea> . As other answers have described, what you are looking for is a WYSIWYG editor, like CKEditor, TinyMCE, or Kendo's Editor.
Complete HTML/CSS Course 2022Use the <textarea> tag to show a text area. The HTML <textarea> tag is used within a form to declare a textarea element - a control that allows the user to input text over multiple rows. Specifies that on page load the text area should automatically get focus.
<textarea> does not support the value attribute.
If what you where looking for NO-jquery tools (pure HTML/CSS + basic JS) as us, then some of the best options found (back in 2016) are:
Nevertheless, those in the list above all convert the element (textarea) into an iframe, so they weren't exactly what we were searching for, finally we found this one which respects the original element (divs or so, but if you use textarea it does creates an additional div), allowing full straightforward JS app development:
We hope this helps you too!
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