the more i deep to javascript more i got confused..!!
.
.
i have put a autocomplete texbox in a row.. which have two more buttons Add/Remove..!!
.
.
With add u can append clone row under original row... and withy delete u can delete the row..!!!!
.
.
Problems when i add new row... which make clone of original row..!! which means that Id of autocomplete also get cloned...!!!!
.
.
Please help me out..!!! :(
my javascript code..!!
function add(oRow)
{ oRow.parentNode.replaceChild(oRow.cloneNode(true),oRow.parentNode.insertRow(oRow.rowIndex+1));
var inpR = oRow.getElementsByTagName('input');
var inpN = oRow.nextSibling.getElementsByTagName('input');
inpR[0].id = 'month_' + parseInt(oRow.rowIndex+2);
iteration = parseInt(oRow.rowIndex+2);
for(i=0;i<inpR.length;i++)
{
if(inpR[i].disabled){inpR[i].disabled=false;};
if(inpR[i].type=='text'){inpR[i].disabled=true;inpN[i].value='';inpN[i].disabled=false};
if(inpR[i].value=='Add'){inpR[i].value='Edit';inpN[i].disabled=true};
} sumus();
var months = new Array(<?= $imp_aUsers; ?>);
$().ready(function() {
for(i=1;i<=iteration;i++)
{
$("#month_"+i).autocomplete(months, {
minChars: 0,
max: 14,
autoFill: true,
mustMatch: true,
matchContains: false,
scrollHeight: 220,
formatItem: function(data, i, total) {
return data[0];
}
})};
});
}
Can anyone help..??? i know its hard to solve..>!! :D