I have a string that contains HTML, for example
var myString = "<div><p>testing</p></div>";
I need to target p and replace "testing" with something else, say "Hello World". I would normally use
$("p").innerHTML = "Hello World";
However, this is part of a string, not part of the DOM. How can I use jQuery's selector system to select from a string of HTML?
var s = '<li>text</li>'; $.parseHTML(s).find("p").text("Hello World"). Not sure why this question is marked a duplicate of one that does not ask for the jquery method of doing this