Are you sure this line isn't called twice, imbricated in a loop or something? If you bind the click event twice, the handler will be reached twice...
$(".btnEdit").bind("click", edit_rows);
you shoud because this kind of code works:
<table>
<tr>
<td>test</td>
<td><img src="#" class="btnEdit" /></td>
</tr>
<tr>
<td>test</td>
<td><img src="#" class="btnEdit" /></td>
</tr>
</table>
$(".btnEdit").bind("click", edit_rows);
function edit_rows() {
console.log("row clicked");
};
edit:
After reading your fiddle, what happens is normal and is explained above
$("#btnInsert").click(function() {
$("input[id^=btnDelete]").bind("click", function () { });
});
Each time you click on btnInsert, you bind previous inputs with a new event handler.
A solution would be
var strId = "btnDelete" + rowCnt;
$("input[id=" + strId + "]").bind("click", function () {
$(this).parent().parent().remove();
});
[
Screenshot of the x generated event handlers]