I have a site in which content is dynamic loaded via jQuery .load(). Sadly, I can't catch an event from the dynamic loaded content even though using .on().
This is my function in which I can't trigger the $("#control_right").on('click')-function after loading changeContent(2):
function changeContent(step){
$('#content').toggle(100);
setTimeout(function() {
$('#content').load("template/step_" + step + ".html");
}, 180);
$('#content').delay(300).toggle(200).queue(function(){
if(step === 1){ // IF STEP 1. CHOOSE MALE OR FEMALE
console.log("step1");
$("#choice_man").on('click', function(){
changeContent(2);
});
$("#choice_woman").on('click', function(){
changeContent(2);
});
}
if(step === 2){ // IF STEP 2. Do something else
$("#control_right").on('click', function() {
console.log("CLICK");
});
}
});
}
I hope my problem is understandable.