How to define event two button in datatable ?

How to define event two button in datatable ?

headshot9xheadshot9x Posts: 59Questions: 16Answers: 1

Hi guys, I have two button in datatable , I want to define different of them

     {
                        "mData": null,
                        "aTargets": [-1],
                        "defaultContent": '<button type="button" id="bt1" class="btn1">Button1</button>'
                    },
                    {
                        "mData": null,
                        "aTargets": [-2],
                        "defaultContent": '<button type="button" id="bt2" class="btn2">Button2</button>'
                    },

As event click

         $('#table tbody>bt1').on('click', 'button', function (e) {
                console.log("button 1 is click");
            });
         $('#table tbody>bt2').on('click', 'button', function (e) {
                console.log("button 2 is click");
            });

How can i do it ?

This discussion has been closed.