I am using $.each to create the button with each array object. I also tried to give each button a specific id, so I can do click event for further coding, but n
$.each
You have to use .on() function to attach an event for dynamically created elements.
.on()
EXAMPLE
$(document).on('click', '#DYNAMIC_ELEMENT_ID', function(){ // your action here });