I have these buttons like so:
<input type="button" id="deleteButton" name="deleteButton" class="btn btn-default deleteButton" value="Delete">
I say these because there are multiples (about 30 of them)
and I have this bind event:
$(".deleteButton").bind("click", function () {
var id = $(this).parent().parent().find('input[name=ID]').val();
$.ajax({
url: "/DepositLog/DeleteItem",
type: "POST",
data: { ID: id, Usr: $("#Usr").val() },
success: function (data) {
MVCGrid.reloadGrid('DepositLogGrid');
}
});
});
And it only works the first time I use it, after that it does not work at all, I have tried using the id as the selector, I have also tried an on event and that also did not work $(".deleteButton").on("click", function () {
What am I doing wrong?