jquery click doesn't work on ajax generated content
Should be done this way.
$('body').on('click', '.button', function (){
alert('click!');
});
If you have a container that doesn't change during the ajax request, this is more performant:
$('.container').on('click', '.button', function (){
alert('click!');
});
Always bind the delegate event to the closest static element that will contain the dynamic elements.
Ok i solved my problem by using the .on() function correctly since i was missing one parameter.
instead of
$(".button").on("click", function() { } );
i used
$(".container").on("click", ".button", function() { } );