How to remove tag from html with JavaScript in iphone UIWebView?

You could try: NSString *str = @"function f(){ var doc = document; var nodes = doc. GetElementsByClassName('Note'); alert(nodes. Length); // it returns node count correctly for(var I = nodes.

Length - 1;i >= 0;i--){ var node = nodesi; if (node){ //node.parentNode. RemoveChild(node); node.parentNode. ReplaceChild(doc.

CreateTextNode(node. InnerHTML), node); } } }f() but this will cause weird results if you got nested tags like span class="Note">foobar= 0;i--){ var node = nodesi; if (node){ //node.parentNode. RemoveChild(node); node.

ClassName = ''; } } }f() Edit: NSString *str = @"function f(){ var doc = document; var aux = doc. CreateElement('span'); //alert(nodes. Length); // it returns node count correctly for(var nodes = doc.

GetElementsByClassName('Note'); nodes && (nodes. Length > 0); doc. GetElementsByClassName('Note')){ var node = nodes0; if (node){ aux.

InnerHTML = node. InnerHTML; for (var el = aux. FirstChild, next = el.

NextSibling; el; el = next, next = next? Next. NextSibling : null){ var tmp = node.parentNode.

InsertBefore(el, node); } node.parentNode. RemoveChild(node); } } }f().

You could try: NSString *str = @"function f(){ var doc = document; var nodes = doc. GetElementsByClassName('Note'); alert(nodes. Length); // it returns node count correctly for(var I = nodes.

Length - 1;i >= 0;i--){ var node = nodesi; if (node){ //node.parentNode. RemoveChild(node); node.parentNode. ReplaceChild(doc.

CreateTextNode(node. InnerHTML), node); } } }f();"; but this will cause weird results if you got nested tags like foobar if remove the class is enough guess you could do something like this: NSString *str = @"function f(){ var doc = document; var nodes = doc. GetElementsByClassName('Note'); alert(nodes.

Length); // it returns node count correctly for(var I = nodes. Length - 1;i >= 0;i--){ var node = nodesi; if (node){ //node.parentNode. RemoveChild(node); node.

ClassName = ''; } } }f();"; Edit: NSString *str = @"function f(){ var doc = document; var aux = doc. CreateElement('span'); //alert(nodes. Length); // it returns node count correctly for(var nodes = doc.

GetElementsByClassName('Note'); nodes && (nodes. Length > 0); doc. GetElementsByClassName('Note')){ var node = nodes0; if (node){ aux.

InnerHTML = node. InnerHTML; for (var el = aux. FirstChild, next = el.

NextSibling; el; el = next, next = next? Next. NextSibling : null){ var tmp = node.parentNode.

InsertBefore(el, node); } node.parentNode. RemoveChild(node); } } }f().

This is gonna work in e-reader for write note to selected text.. and, if I couldnt remove tag which added by me, there will be lots of tags.. I need more to remove known tag completely – relower Oct 18 at 12:13 finally this works for me, thanks for reply! – relower Oct 18 at 15:04 If you really need remove the tags I will have a new version of the code. You could have a look if you need it.

– Prusse Oct 18 at 15:20 Yep, it works too, thanks very much. – relower Oct 180 at 10:04.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions