For example I have returned html in UIWebView text:
<div id="id1"开发者_Go百科><p>Some Text</p></div>
<div id="id2"><p>SOME TEXT</p></div>
And I need to delete tag with id="id2", and return to user, how can I do this?
One solution is call js code which removes that element after content is loaded.
NSString *jsCommand = [NSString stringWithFormat:
@"var element = document.getElementById('%@'); element.parentElement.removeChild(element);",
@"id2",
];
[webView stringByEvaluatingJavaScriptFromString:jsCommand]
精彩评论