I am creating rows dynamically in javascript.As the controls in all rows have same id, i need to assign an id to that control when it is creating.can anyone help me how to assign ID to that control
this is my code
function AddNewRow(tblrowdetails) {
var table = $("tblrowdetails"); //getting the table id
var rowCount = table.rows.length;
var row = table.insertRow(rowCount);
var colCount = table.rows[0].cells.length;
for(var i=0; i<colCount; i++) {
var newcell = row.insertCell(i);
newcell.innerHTML = table.rows[0].cells[i].innerHTML;
switch(newcell.childNodes[0].type) {
case "text":
newcell.childNodes[0].value = "";
break;
case "checkbox":
newcell.childNodes[0].checked = false;
break;
case "select-one":
newcell.childNodes[0].selectedIndex = 0;
break;
}
}
}
}
Where i need to assign id to the control and how to assign pls help me
One of the way could be