Get values of textbox that is added dynamically in button click
Hi,This is the script used by me to add rows dynamically containing textbox
<script type="text/javascript">
var rowCount = 1;
function addMoreRows(frm) {
rowCount++;
var recRow = '<p id="rowCount' + rowCount + '"><tr ><td ><input name="" type="text" size="17%" maxlength="120" /></td><td><input name="" type="text" maxlength="120" style="margin: 4px 5px 0 5px;"/></td><td><input name="" type="text" maxlength="120" style="margin: 4px 10px 0 0px;"/></td><td> <a href="javascript:void(0);" onclick="removeRow(' + rowCount + ');">Delete</a></td></tr></p>';
jQuery('#addedRows').append(recRow);
}
function removeRow(removeNum) {
jQuery('#rowCount' + removeNum).remove();
}
</script>
code in aspx
<table rules="all" style="background:#fff;">
<tr>
<td style="font-size:14px;" >Weight</td>
<td style="font-size:14px;">MRP</td>
<td style="font-size:14px;">Price</td>
<td><span style="font:normal 12px agency, arial; color:blue; text-decoration:underline; cursor:pointer;" onclick="addMoreRows(this.form);">
Add More
</span>
</td>
</tr>
<tr id="rowId" class="nr">
<td><input name="" type="text" size="17%" maxlength="120"/></td>
<td><input name="" type="text" size="17%" maxlength="120"/></td>
<td><input name="" type="text" size="17%" maxlength="120" /></td>
<td></td>
</tr>
<tr>
<td colspan="6" >
<p id="addedRows"></p>
</td>
</tr>
</table>
now i want to get the values of dynamically added tr textbox and insert in database.
so how can i get the count of tr that is added dynamically in jquery?
how can i get the values of all textbox that is added dynamically in jquery?