I have a string in node with a html document like this:
<p id="text">First text</p>
<script>
document.getElementById('text').innerHTML = 'Second text';
</script>
And I want to get the resulting html document after running the scripts like this:
<p id="text">Second text</p>
<script>
document.getElementById('text').innerHTML = 'Second text';
</script>
I don't know how to do it and I didn't found anything that can help. The scripts are more complex, this is an example