I generate the set of buttons within html table as follows and then I want to call to function when it click. $.each(childData, function(key, item) { var packPath = key.replace(/_/g, "/"); //Replace underscore with slash div.innerHTML = div.innerHTML + '<td>'+key+'</td>' + '<td><button type="button" data-id="'+key+'" class="download btn btn-success btn-xs">Originals</li></td></div>'; }) This is how I call the function but it's not working. $(".download").click(function(){ alert(); }); Where is the wrong in above code? Try this: $(document).on('click', '.download', function(){ // Your Code });