I am not able to traverse a custom html string with Jquery, like in this example:
html = '<a href="http://www.site.com"><img width="800" src="http://www.site.com/pic.jpg" alt="" /></a><br /><br />Description<br />';
found = $(html).find("a").length;
"found" returns 0, while I would expect to get 1
I suspect I'm doing something really stupid here, but after hours I still don't see what's wrong.
You need to put your HTML code into a “root element” like a DIV:
$("<div>"+html+"</div>").find("a").length
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With