Skip to content Skip to sidebar Skip to footer

Not To Open A New Page When Table Check Box Is Clicked

I have this JavaScript which opens new page when I click on a table row: $(document).ready(function () { $('table[id$='dataTable']').find('tbody').on('click', 'tr', function ()

Solution 1:

Listen for clicks on table cells instead of rows, then ignore if the cell's in the first column.

Sticking with jQuery, this might work:

$(document).ready(function () {
    $('table[id$="dataTable"]').find("tbody").on("click", "td", function () {
        if (this.cellIndex > 0) {
            $(this.parentNode).find('a[id$="lnkHidden"]').trigger("click");
        }
    }).on("click", 'a[id$="lnkHidden"]', function (e) {
        e.stopPropagation();
    });
});

Post a Comment for "Not To Open A New Page When Table Check Box Is Clicked"