Add calendar datepicker with Jquery on dynamic table.
- by Cesar Lopez
I am trying to add a Jquery calendar picker to a text box at the time of creation, but I cant find how.
When I press a button, it will create a table, the element I want to attach the Jquery calendar picker is:
var txtDate = createTextInput(i, "txtDate", 8, 10);
txtDate.className = "datepicker";
this.newcells[i].appendChild(txtDate);
I tried adding at the end :
txtDate.datepicker();
But does not work. Can anybody help?
Thanks.
Note: CreateTextInput is:
function createTextInput(i, strName, size, maxLength) {
var input = document.createElement('<input>');
input.type = "text";
input.name = strName;
input.id = strName + i;
input.size = size;
input.maxLength = maxLength;
return input;
}