Win a copy of Java EE 8 High Performance this week in the Java/Jakarta EE forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

getting reference of dynamically created field  RSS feed

Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
the below code is adding a row in a table with a td of input, i am giving name of input is xyz, but when i tries to get refernce by using
document.getElementsByName("xyz")[0].value, then it is not picking its value

var tbl = document.getElementById('tblAddress');
var lastRow = tbl.rows.length;
var iteration = lastRow;
var row = tbl.insertRow(lastRow);
var cell0 = row.insertCell(0);
var el = document.createElement('input');
el.type = 'text';
el.NAME = 'xyz';
el.size = 30;
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!