How to make an element's content editable with JavaScript (or jQuery)
JavaScript:
document.getElementById('elementId').contentEditable = 'true';
Solution to toggle editable on/off using a click handler:
$('button').click(function(){
var $div=$('div'), isEditable=$div.is('.editable');
$div.prop('contenteditable',!isEditable).toggleClass('editable')
})
DEMO
Look at this example i've made: http://jsfiddle.net/K6W7J/
JS:
$('button').click(function(){
$('div').attr('contenteditable','true');
})
HTML:
<button>CLICK</button>
<div>YOUR CONTENT</div>