Ive got a
js-function in a webview that focuses on a select-list and selects it, which works fine.
Code:
function selectLetter()
{
document.getElementById("select_letter").focus();
document.getElementById("select_letter").select();
}
However, when invoking the same functionality from obj-c code using stringByEvaluatingJavaScriptFromString, it wont execute. Nothing happens.
Code:
[self.webView stringByEvaluatingJavaScriptFromString:[NSString stringWithFormat:@"document.getElementById('select_letter').focus();"]];
[self.webView stringByEvaluatingJavaScriptFromString:[NSString stringWithFormat:@"document.getElementById('select_letter').select();"]];
Ive tried other types of code with stringByEvaluatingJavaScriptFromString manipulating just that select-list, which has worked fine. For instance:
Code:
[self.webView stringByEvaluatingJavaScriptFromString:[NSString stringWithFormat:@"document.getElementById('select_letter').style.visibility='hidden';"]];
Any suggestions?