UIWebView stringByEvaluatingJavaScriptFromString

后端 未结 1 673
我寻月下人不归
我寻月下人不归 2020-12-28 09:48

I\'m stuck on getting some pretty basic JS to run in my UIWebView. In the web view\'s delegate, I have :

- (void)webViewDidFinishLoad:(UIWebView *)wView {
          


        
相关标签:
1条回答
  • 2020-12-28 10:43

    Changing

    NSString *someHTML = [wView stringByEvaluatingJavaScriptFromString:@"document.getElementsByClassName('box')[0]"];   
    

    to

    NSString *someHTML = [wView stringByEvaluatingJavaScriptFromString:@"document.getElementsByClassName('box')[0].innerHTML;"];   
    

    (added the .innerHTML)

    makes all the difference in the world . . .

    0 讨论(0)
提交回复
热议问题