-4

I have a table which populates several rows with a button element, these rows are generated dynamically using php script:

<button class="btn btn-default btn-xs data_upload">Upload</button>

I simply want to detect a click on this button using jquery -

$(".data_upload").on("click", function() {
    alert("asdf");
});
Namit
  • 1,314
  • 8
  • 20
  • 36

1 Answers1

2

You have to delegate the event with the nearest static parent, i just used document since i dont know the nearest static parent in your context.

Try,

$(document).on("click",".data_upload", function() {
    alert("asdf");
});
Rajaprabhu Aravindasamy
  • 66,513
  • 17
  • 101
  • 130