Suraj Air Suraj Air - 6 months ago 21
HTML Question

get the text content from a contenteditable div through javascript

I want retrieve the text content from a contentEditable div through javascript. What are the options of doing this? I've tried innerHTML but it doesn't work.

Answer

use jQuery and do

var content = $('#my-contenteditable-div').html();

also look up these links:

http://west-wind.com/Weblog/posts/778165.aspx

http://stackoverflow.com/questions/3455931/extracting-text-from-a-contenteditable-div