My problem is the following, the jQuery Post success method returns some data , that data I'm prepending to a div but it appears that the data what I'm prepending is not in the DOM.
jQuery Post code:
$('#form').submit(function() {
var text = $("#input").val();
$.ajax({
type: "POST",
url: "file.php",
data: "name=" + text,
success: function(data) {
$("#app").prepend("<span class='delete'>" + data + "</span>");
}
});
return false;
});
This is the code what deletes the span but it's not deleting the prepended element.
$('.delete').on('click' , function() {
$(this).hide();
});