I would need to transform text to html jquery object, so that I had an access to the values specified in the and the following example.
var htmlContent = '<!doctype><html><head><title>Lorem Ipsum</title>Other code</head><body><div id="content"><h1>Custom code</h1><h2>Highlight2</h2></div></body></html>';
I want to modify so that I could work with HTML content in jquery follows
htmlContent.find('head title').text();
to h1
and h2
know approaches, probably because they are not vnotrene tags in <div id="content"></div>
Currently I have the following code:
var htmlContent = $(htmlContent);
But it does not work properly.
Thank you for counseling.