Here is the html
<div class="parentDiv">
<div class="childDiv">
<!-- here to add button -->
</div>
</div>
And here is the jquery code :-
$.ajax({
url : "url.php",
type : "POST",
data : {someData : "some data"},
success : function(data){
$("#childDiv).html("<button id='clickMe'>Click me</button>");
}
});
This code not working after element is added through ajax
$("#clickMe").on("click",function(){
alert("please help!");
});
the #click me is not working.
How can I fix it, make it work ?