I make div as editable. while i tried to parse div\'s text, i was needed to do the below regular expression.
innerDOM = \"
DOM manipulation is one of the things jQuery was made for. Investing in learning jQuery will take you a long way towards writing DOM traversal and modification.
$("div[style='cursor: text']").unwrap().prepend("
");
unwrap deletes the element but keeps the children intact. The jQuery Attribute Equals Selector is used to select all divs with the cursor style attribute. You can run it live here.
You could make this more robust as currently you would not select a div with more or less whitespace or with other trivial differences. For example: $("div.textCursor")