ios - Auto focus text field in UIWebview -


I am loading the 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 it seems that there is no work to do. "J_captcha" is the name of the textfield. How can I get it?

This did the trick for me

  NSString * evalStr = [NSString StringWithFormat: @ "setTimeout (function () {document.getElementsByName ('j_captcha') [0]. Focus ();}, 1000);"]; [WebView stringByEvaluatingJavaScriptFromString: evalStr];  

This post got help -


Comments

Popular posts from this blog

java - org.apache.http.ProtocolException: Target host is not specified -

c# - Chart control: Design messed Up after clearing and re-adding Y-Values -

ruby on rails - Apipie interferes with proper error codes -