A div doesn't belong inside a script tag. Javascript belongs inside a script tag.
Take the div out of the script tag and it should be fine.
A div doesn't belong inside a script tag. Javascript belongs inside a script tag.
Take the div out of the script tag and it should be fine.
The trick is simple, change loadHTML
to loadXML
with one condition,
the HTML string has to be always well-formed
$dom->loadXML($html2);