简体   繁体   中英

How can I get rendered text of any HTML in ExtJS?

There is a HTML which saved in a textareafield;

"<pre class="brush: sql"><span style="color:#999;">SELECT </span>ATM.TBL_SKR_LISTENER.MSG_ID,ATM.TBL_SKR_LISTENER.MSG
 <span style="color:#999;">FROM </span>ATM.TBL_SKR_LISTENER</pre>"

I want to get this;

SELECT ATM.TBL_SKR_LISTENER.MSG_ID,ATM.TBL_SKR_LISTENER.MSG FROM ATM.TBL_SKR_LISTENER

How can I get rendered value of this HTML code with using ExtJS ?

Thanks

it's rather simple, just create div and set innerHTML of this div to textarea value, then get textContent or innerText of the div. See this fiddle for more details: https://fiddle.sencha.com/#fiddle/c1f

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM