Skip to content Skip to sidebar Skip to footer

Datatable Enable Onclick On A Specific Column

I have a datatable and I want the 2nd column to be the only clickable column. Here is a picture of the design. I intended the Reference ID column (2ndcolumn) to be the one to be c

Solution 1:

Do something like this

$(document).on("click","#dataTbl td:nth-child(2)",function(){
        alert($(this).text());
});

Jsfiddle example (click 2nd column) : https://jsfiddle.net/synz/zLykna0p/

Solution 2:

You could try this.

$('#exampleTable tbody tr').on('click', 'td:eq(1)', function () {
 /* Your function code here */
} );

Post a Comment for "Datatable Enable Onclick On A Specific Column"