samedi 28 février 2015

html - javascript not working in dynamic generated html form


A table row in a form which is dynamically generated with a "Add row " button.


One field in the row is Date which uses datepicker to select the date.


PROBLEM:


The datepicker doesn't show when the row is dynamically generated.


I am using bootstrap 3.


Here is the code that generate table row on button click.



function addRow(tableID) {
var table = document.getElementById(tableID);
var rowCount = table.rows.length;
if(rowCount < 40){ // limit the user from creating fields more than your limits
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;
}
}else{
alert("Maximum Players per Entry is 40");

}


}





Aucun commentaire:

Enregistrer un commentaire