I created a div as defined below
<div class="area1">
</div>
With this ajax call I changed the html for above div
$('#abutton').click(function(e) {
e.preventDefault();
$.ajax({
url: 'do',
type: 'POST',
dataType: 'json',
cache: false,
data: {id:this.id},
success: function(data) {
$('.area1').html(data);
},
failure: function() {
alert('Please try again..!');
}
});
});
now div content looks like this
<div class="area1">
<input type="text" placeholder='Name'>
<button id='submit'>Submit</button>
</div>
Now I want to perform some action on button click
$('.area1 button').click(function(e){
e.preventDefault();
alert(this.id) ;
});
but this second ajax is not selecting the button
Can anyone tell the correct method