View Full Version : stringByEvaluatingJavaScriptFromString - changing several elements' css?

Mar 5, 2009, 07:05 PM
Feels like Im spamming the forum today, but I assure you that Im also looking for solutions by my own, and will always post any solution that I find. Promise :)

Anyway, how can I, by using stringByEvaluatingJavaScriptFromString, go trough a html-page and change the style of all the elements with, for instance, the name "myTable"?

I mean, how can I know how many of those elements there are on the html-page in question from the objc-environment? Or is my only option to make a large enough loop (which would slow down the app, though)?

[self.webView stringByEvaluatingJavaScriptFromString:[NSString stringWithFormat:@"document.getElementByName('myTable')[0-n].style.visibility='hidden';"]];