javascript - Dynamically create and assign id to an input? -
my code below i'm unable verify if it's correct, or if is, why can't access created text inputs id
for (i=0;i<t;i++) { div.innerhtml=div.innerhtml+"<input id="+i+"\" type='text' value="+(i+1)+">"+"<br>"; div1.innerhtml=div1.innerhtml+"<input id=a"+i+"\" type='text' value=a"+(i+1)+">"+"<br>"; gont.innerhtml=gont.innerhtml+i; }
var t = 2; var div = document.getelementbyid('iddiv'); (i = 0; < t; i++) { div.innerhtml = div.innerhtml + "<input id=" + + "\" type='text' value=" + (i + 1) + ">" + "<br>"; div1.innerhtml = div1.innerhtml + "<input id=a" + + "\" type='text' value=a" + (i + 1) + ">" + "<br>"; gont.innerhtml = gont.innerhtml + i; }
Comments
Post a Comment