I am trying to create dynamic checkbox in UIWebView. I am using this code :
NSMutableArray *array = [[NSMutableArray alloc]initWithObjects:@"Sudhaadagdudgdada",@"qwertyuiopo",@"asdfghjkl", nil];
for (int j = 0; j < array.count; j++)
{
NSString *html = [NSString stringWithFormat:@"<div id='check'></div><script> str=''; str += '<input type=\"checkbox\" name=\"one_'+i+'\" value=\"'+%@+'\" onclick=alert(this.value); />' document.getElementById(\"check\").innerHTML=str;</script>",[array objectAtIndex:j]];
[self.webview loadHTMLString:[NSString stringWithFormat:@"%@",html] baseURL:nil];
}
But there is no checkbox in UIWebView. Please help me out.
If u want to load html in webview u need to add tags for it.Update ur code as below
//OR If u want to load javascript file as u mentioned in your code..modify as below
Hope it helps you...
I have solved by this :