I have to make a dynamic page which contains only div elements.
Now in each div, I have to add inputs, textareas, a etc.
Two options I have...
First:[code=javascript]var inp = document.create Element('input' );
inp.className = 'abc';
inp.type = 'text';
inp.value .......
.....
....
document.getEle mentById('divId ').appendChild( inp);[/code]
Second:[code=javascript]document.getEle mentById('divId ').innerHTML = '<input type="text" class="abc" value=......... .......... >';[/code]
Since I have to call this same function many times, which will give better results as far as performance is concerned?
Now in each div, I have to add inputs, textareas, a etc.
Two options I have...
First:[code=javascript]var inp = document.create Element('input' );
inp.className = 'abc';
inp.type = 'text';
inp.value .......
.....
....
document.getEle mentById('divId ').appendChild( inp);[/code]
Second:[code=javascript]document.getEle mentById('divId ').innerHTML = '<input type="text" class="abc" value=......... .......... >';[/code]
Since I have to call this same function many times, which will give better results as far as performance is concerned?
Comment