Find element within HTML string

find, html, jquery

Solution

You are very close, wrap your variable in `$()`

var $div = $(html);
$div.find(".find-me").remove();

If you want to return to string can do something like:

var htmlString = $('<div>').append($div).html();

Problem

Is it possible to find an element within a string of HTML rather than from the DOM? Example, ``` var html = "<div><span class='find-me'></span></div>" $("html").find(".find-me").remove(); ```

Original source