[英]extjs how to get selected html from textarea
I have extjs htmleditor with textarea. 我有带有textarea的extjs htmleditor。 ANd i want to get selet html value.
我想获取selet的html值。
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. 小提琴在这里: http : //jsfiddle.net/DCGRg/76/-您可以通过输入内容并添加样式然后单击右侧工具栏上的组合框来触发事件。
i saw the code like that, but it's not getting me html, just text is getting: 我看到了这样的代码,但是并没有让我得到html,只是文本得到了:
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? 问题是:如何从textarea获取html?
InnerHTML only returns only the child contents, outerHTML is return with current note. InnerHTML仅返回子内容,outerHTML返回当前注释。 For Example:
例如:
"sample text" => using innerHTML => sample text “示例文本” =>使用innerHTML =>示例文本
"sample text" => using outterHTML => <span>sample text</span> “示例文字” =>使用outterHTML => <span>示例文字</ span>
I changed in your code innerHTML as outerHTML like bellow please check the sample 我将您的代码innerHTML更改为externalHTML,如下所示,请检查示例
text = fontEl.outerHTML;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.