I am trying to put $htmlString into an existing div tag that I have
<?php
$htmlString = "<ul><li>some items</li><li>some items</li><li>some items</li></ul>";
$dom = new domDocument;
$dom->loadHTML($html);
$div_tag = $dom->getElementById('demo');
echo $dom->saveHTML($div_tag);
?>
In the div tag, I already have some content and I want to append $htmlString into the div tag
<div id="demo"><h1>Recent Posts</h1></div>
I want the output to be
<div id="demo"><h1>Recent Posts</h1>
<ul><li>some items</li><li>some items</li><li>some items</li></ul>
</div>
As $htmlString is actually produced from another function so I cannot simply do
<div id="demo">
<h1>Recent Posts</h1>
<?php echo "<ul><li>some items</li><li>some items</li><li>some items</li></ul>" ?>
</div>