I have some html extracted to a var string and you want to then use the jQuery element select only on that string. Is it possible?
For example:
HTML:
<div class=message> This is a message. Click <a class=link id=link1 href=example.com>here</a> </div>
JQuery
$('div.message').each(function(i, item) { myHtml = $(this).html();
So, in this example, I want to extract the id and href tags from the <a> tag in myHtml .
thanks
jquery jquery-selectors
user191688
source share