I have an HTML page which has a div tag in it,
<htmL>
<head/>
<body>
<div id ="Required">
<table>
<tr>
<td/>
</tr>
</table>
</div>
</body>
</html>
While displaying the above website using UIWebView, I need to focus on the div tag as soon as the webpage loads. So basically, the user should see the table(under the div tag) on his iPhone as soon as the url loads under UIWebView.
What have I tried till now?
-(void) ViewDidLoad()
{
self.webView.delegate = self;
NSURL *url = [NSURL URLWithString:@"www.nameofthewebsite.com"];
NSURLRequest *req = [NSURLRequest requestWithURL:url];
[self.webView loadRequest:request];
}
-(void) webViewDidFinishLoad:(UiWebView*) webView{
self.webView stringByEvaluatingJavaScriptFromString:@"document.getElementById('Required').focus()];
}
I still do not see my div tag being focussed when the page loads. I also tried using the load html string function. Am I missing something?