spiderplant0
Programmer
Hi,
How do I use the document.evaluate() method on a string of HTML to find something within the string?
E.g. if I have this string:
var stg = "<div>The best-laid schemes o' <span>mice</span> an' men</div>";
I'd like to convert this string into something that I can run the document.evaluate() on so that I can find the contents of the SPAN element without loading the string into a real browser page.
(I know how to use document.evaluate() as I've used it before or real web pages - I just dont understand how to run it on a 'virtual document' (this probably isnt the correct term)).
Thanks
How do I use the document.evaluate() method on a string of HTML to find something within the string?
E.g. if I have this string:
var stg = "<div>The best-laid schemes o' <span>mice</span> an' men</div>";
I'd like to convert this string into something that I can run the document.evaluate() on so that I can find the contents of the SPAN element without loading the string into a real browser page.
(I know how to use document.evaluate() as I've used it before or real web pages - I just dont understand how to run it on a 'virtual document' (this probably isnt the correct term)).
Thanks