javascripthtml

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.


Solution

  • use jQuery and do

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

    also look up these links:

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

    Extracting text from a contentEditable div