0

How to read text value from UIWebview

by Deepak Dhakal 3. April 2012 10:41

Use [UIWebView stringByEvaluatingJavascriptFromString:] method and get the values by executing the javascript.

Example: If your html is:

<html>
 
<body>
     
<input id="myId" type="text" value="TextValue"/>
 
</body>
</html>

Following code can get you the value of the text field:

   NSString* value = [webView stringByEvaluatingJavaScriptFromString:@"document.getElementById('myId').value"];

Tags:

iPhone

Powered by BlogEngine.NET 1.5.0.7
Original Design by Laptop Geek, Adapted by onesoft