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

Popular posts from this blog

java - WrongTypeOfReturnValue exception thrown when unit testing using mockito -

php - Magento - Deleted Base url key -

android - How to disable Button if EditText is empty ? -