this works in Jquery :
<input type="button" class="go" value="GO" />
$(".go").click(function() {
$("#test").html("TEST TEST TEST");
});
But if I try to access the go function from a button created using the following it fails.
$(".new").click(function() {
$.ajax({
url: $(this).attr("data-value"),
success: function(data, textStatus, xhr) {
$('#DIV').html('<input type="button" class="go" value="go" />');
}
}
});
});
This code is used when another function click function completes.
Any reason why ?
Thanks
.clickbinds only to elements that exist at the time the code is run. You want something like.live(deprecated, but documentation shows current proper methods) which binds to elements that may be created later...