0

I'm trying to select a button that is made using a jQuery statement. This is the button:

$('#mainTable').append('<tr><td>' + 
    elem.date + '</td><td><button class="dButton">Click here</button></td></tr>')

Then here's the selector for the button:

$(".dButton").click(function () {
  alert("alert");
})

I've checked that the top bit of code is called first so the button is created first, and then the second bit, but whenever I click the button it just won't run the second bit of code.

mplungjan
  • 155,085
  • 27
  • 166
  • 222
JL9
  • 523
  • 3
  • 17

0 Answers0