click event is falled on a loop when clicked on a dynamic table cell
$(
'.ListTable'
).find(
'tr'
).not(
'.HeaderRow'
).find(
'td:last'
).prev().click(
function
() {
var
vEditIndex = $(
this
).parent().parent().children().index($(
this
).parent()) - 1;
var
vRowForEdit = $(
'.ListTable'
).find(
'tr:eq('
+ (vEditIndex + 1) +
')'
);
var
vContainerId = vRowForEdit.find(
'td:eq(0)'
).find(
'input:eq(0)'
).val();
var
vBatchNo = vRowForEdit.find(
'td:eq(0)'
).find(
'input:eq(1)'
).val(); GetBatchDetails(vContainerId, vBatchNo);
GetContainerDetails(vContainerId);
});
I have use the above function to edit a list from a dynamic table. But the problem is that whenver I click on the edit cell of the table the click event is fall on a loop up to the length of the table row. i.e. if the table has 5 rows and I click on the 1st row than the click event is called for 5 times, if I click on the 2nd rows than it called for 4 times, if I click on the 3rd rows than 3 times and so on. How can I resolve this problem?