I have html code saved in a variable called myHtml
<div>
<p data-id="1">A</p>
<p data-id="2">B</p>
<p data-id="3">C</p>
</div>
I need to change the value of before appending this to html.
My code doesn't change the value
$(myHtml).find('p[data-id="1"]').text("new text");
Also need to consider changing src of an image like
<img src="image.jpg" />
So I need something like
$(myHtml).find('img').attr("src", "new-image.jpg");
Thanks in advance