Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
102
rated 0 times [  103] [ 1]  / answers: 1 / hits: 62782  / 15 Years ago, mon, july 27, 2009, 12:00:00

Do you know how to make a <div> editable with JavaScript? I'm looking for cross-browser solution.



Something similar to a rich text area, but that uses an editable <iframe>. I need something similar for a <div>.

I don't want to use a replacement textbox.


More From » html

 Answers
29

I found out how.



You use the contentEditable property of the DOMElement, like so



<div onClick=this.contentEditable='true';>
lorem ipsum dolor lorem ipsum dolorlorem ipsum dolor
</div>

[#99049] Wednesday, July 22, 2009, 15 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
leog

Total Points: 225
Total Questions: 113
Total Answers: 118

Location: Oman
Member since Wed, Apr 12, 2023
1 Year ago
;