I am loading a webview form in my iOS app and I want to autofocus a textfield on the form. I tried
NSString *focus = [NSString stringWithFormat:@"document.getElementsByName('j_captcha')[0].focus()"];
[self.webView stringByEvaluatingJavaScriptFromString: focus];
But that doesnt seem to work. "j_captcha" is the name of the textfield. How can I achieve this?