Click on row except one specific td by jquery


<script type="text/javascript">


$(document).ready(function(){

$("#example").DataTable();
$("#example tbody").on("click","tr",function(e){
alert("clicked on tr");

var cell=$(e.target).closest('td');
if(cell.index()==5 ){
alert("Dont Run");
}
else{alert("Run");
}

});

});


\*\\\\\\\\\\\\\\\\\\\\\\\\\\Or you may use following also\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*\


$(document).ready(function(){

$("#example").DataTable();
$("#example tbody").on("click","tr",function(e){
alert("clicked on tr");

var cell=$(e.target).closest('td');
if(cell.index()!= 5 ){
 alert("Dont Run");
}

});

});


</script>


Download Demo Code

Comments

Popular posts from this blog

datatable with both top and bottom scroll bar.

Display Loader and disable page while waiting for ajax request

Invalid bean property or is not readable to loading Jsp page