I need to add an event using bind() after replaceWith(), but the elements exist only after the replaceWith() is executed. How do I add events after the elements are loaded?
My code looks something like this:
$.ajax({
type: 'GET',
url: trElement.find(".editRecord").attr("href") + '?id=' + tdId.html(),
success: function(data, textStatus, jqXHR) {
trElement.replaceWith(data);
trElement.find(".btnEditRecord").bind("click", save);
trElement.find(".btnCancelEditRecord").bind("click", cancel);
}
});
If you can, please exemplifies.
Thank you very much.