I have extjs htmleditor with textarea. ANd i want to get selet html value.
Fiddle is here: http://jsfiddle.net/DCGRg/76/ - you can trigger event by entering something and adding styles and then clicking on the combobox at toolbar right.
i saw the code like that, but it's not getting me html, just text is getting:
content = selection.extractContents();
//create span and wrap it around selection
fontEl = document.createElement("span")
fontEl.appendChild(content);
text = fontEl.innerHTML
The question is: how to get html from textarea?
InnerHTML only returns only the child contents, outerHTML is return with current note. For Example:
"sample text" => using innerHTML => sample text
"sample text" => using outterHTML => <span>sample text</span>
I changed in your code innerHTML as outerHTML like bellow please check the sample
text = fontEl.outerHTML;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.