[jQuery] appending ajax form and inserting form input

[jQuery] appending ajax form and inserting form input


Hello there,
i'm new to jquery, and i have this problem.
i have this button that will add a group of inputs on a form
$('#actionbutton').click(function() {
window.open('addaction.asp?oID=<'%=
Session("orderID")%>','myWindow','width=800,height=600');
var $old = $("#actionDiv").html();
$("#actionDiv").load("addaction.asp?actionNumber="+actionNumber
+"",function(){
$(this).prepend($old);
actionNumber = actionNumber + 1;
});
});
in addaction.asp, there is an action that will add another input
file.
the problem is that when i click the add action for the 2nd or
third to
nth time
i no longer add a file input to one's previous
code for adding a file input
$('#addfile'+counter).click(function() {
var myTable = document.getElementById('myTable'+counter);
var tr = myTable.insertRow(myTable.rows.length - 1);
var td1 = tr.insertCell(0);
var td2 = tr.insertCell(1);
td1.className = "valignTop"
td1.innerHTML='<th">File ' + upload_number + ': </th>';
td2.innerHTML='<input type="file" name="file' + upload_number +
'""
/>';
upload_number++;
});
thanks for a help