How to use following javascript code in Objective-C ?
var theFormId = $('form').filter(function() {
return this.innerHTML.indexOf('forgot your password') != -1;
}).attr('id');
HOw to use code above in UIWebView's stringByEvaluatingJavaScriptFromString: method ?
I used the code above with Objective-C as follows:
NSString *formID = [NSString stringWithFormat:@"%@",[self.browser stringByEvaluatingJavaScriptFromString:@"$('form').filter (function() {var text = this.innerHTML.toLowerCase();"
"return text.indexOf('forgot your password') != -1 || "
"text.indexOf('remember me') != -1;}).attr('id');"] ];
When trying to log formID , it prints nothing. Is there any syntax error in my code ?