开发者

UIWebView Deleting tags from html

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]
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜