简体   繁体   中英

How to remove highlighted formatting of window.find(text)

After a text search in a WebView (Android) with JavaScript by means of window.find(text) , using code from this SO post , is successful and the corresponding text is highlighted.

Unfortunately I am not succeeding in finding the code for removing that formatting. I tried various methods (some from StackOverflow) without success, neither works what I deem the right one:

document.designMode = 'on';
document.execCommand('RemoveFormat', false, null);
document.designMode = 'off';

How can I remove the formatting?

我解决了一个难题,删除了execCommand HiliteColor添加的span元素(将属性分配给加载时出现的原始span)(如果有):

addedSpans[i].outerHTML=addedSpans[i]innerHTML

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