Can <div contenteditable="true"><a href="page.html">Some</a> Text</div>
be used instead of texarea and then passed trough form somehow?
Ideally without JS
The contenteditable attribute specifies whether the content of an element is editable or not. Note: When the contenteditable attribute is not set on an element, the element will inherit it from its parent.
Definition and Usage The contenteditable attribute specifies whether the content of an element is editable or not.
The contenteditable is used to specify whether the element's content is editable by the user or not. Syntax: <element contenteditable="true|false"> This attribute has two values. true: If the value of the contenteditable attribute is set to true then the element is editable.
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.
Using HTML5, how do I use contenteditable fields in a form submission?
Content Editable does not work as a form element. Only javascript can allow it to work.
EDIT: In response to your comment... This should work.
<script> function getContent(){ document.getElementById("my-textarea").value = document.getElementById("my-content").innerHTML; } </script> <div id="my-content" contenteditable="true"><a href="page.html">Some</a> Text</div> <form action="some-page.php" onsubmit="return getContent()"> <textarea id="my-textarea" style="display:none"></textarea> <input type="submit" /> </form>
I have tested and verified that this does work in FF and IE9.
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