How to make an element's content editable with JavaScript (or jQuery)

user3117575 picture user3117575 · Dec 29, 2013 · Viewed 59.4k times · Source

How would I make it so the content of an element could be made editable through native JavaScript (DOM) and/or jQuery?

Answer

nicael picture nicael · Apr 1, 2014

JavaScript:

document.getElementById('elementId').contentEditable = 'true';