-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,284
  • 8
  • 19
  • 35

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
  • 64,912
  • 15
  • 96
  • 124