could not able to catch the onclick event of a datatable button's

could not able to catch the onclick event of a datatable button's

thippeswamydcthippeswamydc Posts: 6Questions: 2Answers: 0

Hi,
I'm trying to provide a function to a update button but the jquery is not able to catch the button click event, what would be the problem?live.datatables.net/nufimobe/1/edit
see code $('#tableData tbody').on('click','button',function(){alert('function is called');});

This question has accepted answers - jump to:

Answers

  • colincolin Posts: 15,240Questions: 1Answers: 2,599
    Answer ✓

    Hi @thippeswamydc ,

    You're create the event before the buttons are created - if you move it to initComplete, everything works as expected - see here.

    Cheers,

    Colin

  • thippeswamydcthippeswamydc Posts: 6Questions: 2Answers: 0

    Hi @colin , The link shared by u is not showing the alert msg, I don't think it's working properly.

  • colincolin Posts: 15,240Questions: 1Answers: 2,599
    Answer ✓

    No, I changed it to be console.log() as the alerts are blocked.

  • thippeswamydcthippeswamydc Posts: 6Questions: 2Answers: 0
    edited June 2019

    You are right.
    Thank you, it's happening as expected.

This discussion has been closed.