Search code examples
jqueryasp.netgridviewmouseclick-event

Click event of asp image-button inside gridview using jquery


i have a grid-view, which contains an asp image-button for deleting row, i want to get the click event of that image-button using jquery, i want to animate the row before that row is deleted from database, i dont know what could be the best code for that, I used the below code, but it does not seems working.

$("#dnn_BlogCommentManager1_grdBlogComments td :img").click(function () {
            alert($(this).find('td:eq(4) :input').val());
        });

*************** UPDATES ***********
i have 2 image-button inside gridview, i want the click event of the delete button only.


Solution

  • There is no psuedo selector like :img. You can use type selector image. Use closest to find the parent tr and then you can find the required td element inside the tr. Try this.

    $("#dnn_BlogCommentManager1_grdBlogComments [type=image]").click(function () {
        alert($(this).closest('tr').find('td:eq(4) :input').val());
    });