Sharma Raushan

Sharma Raushan

  • NA
  • 527
  • 13.6k

Button on click on dataTable is not firing.

Dec 1 2020 4:42 AM
I have a datatable in mvc 
  1. $(document).ready(function () {  
  2.        
  3.        $("#tblEmployee").dataTable({  
  4.   
  5.            ajax: {  
  6.                type: "get",  
  7.                url: "/Employee/GetAllEmployee",  
  8.                dataType: "json",  
  9.                dataSrc: ""  
  10.   
  11.            },  
  12.            columns: [{ 'data''Id' },  
  13.                      { 'data''Name' },  
  14.                      { 'data''Salary' },  
  15.                      {  
  16.                          'data''Id', render: function (data, type, row) {  
  17.                              return '<button class="btn btn-info btn-sm btnEdit" data-Id=' + row.Id + '>' + 'Edit' + '</button>';  
  18.   
  19.                          }  
  20.                      },  
  21.                      {  
  22.                          'data''Id', render: function (data, type, row) {  
  23.                              return '<button class="btn btn-info btn-sm btnDelete" data-Id=' + row.Id + '>' + 'Delete' + '</button>';  
  24.   
  25.                          }  
  26.                      }  
  27.            ]  
  28.   
  29.   
  30.        });  
  31.    });  
Edit click is not firing
  1. $(".btnEdit").Click(function(){  
  2.   
  3. alert("hello");  
  4.   
  5. });  
 

Answers (1)