I’m trying to remove all img tags from the DOM and the elements that follow each one. The catch is that my content is all loaded via jQuery ajax and so by executing a $(‘img’).remove(); the content hasn’t loaded and so there are no imgs to remove. Any suggestions?
$.ajax({
url: entry.link,
dataType: "html",
success: function(response) {
$('#entriesHtml').append("<h3><a href='#'>" + entry.title + "</a></h3>" + "<div>" + $(response).find(".ui-widget-detail").html() + "</div>");
}
});
You could render the html with
display:none, remove the img tags, and thenshow()the html.