I am trying to port over an old application into a new solution, however the js code has been changed so I cannot understand it.
I would like to get a parent HTML element "output" and select all child elements as if the user has highlighted.
From there, I would then like to copy this selection to the clipboard.
I can't seem to find any solution online for the first part and I fear solving the first part would still raise issues for the second part.
Any assistance on how to achieve this would be appreciated.
EDIT: The html is being populated with data, I have included a fake version due to being unable to share the actual design.
<div id="output">
<h1>My Name</h1>
<img src="" />
</div>
I would like to highlight the rendered HTML (not the outer HTML) and copy to clipboard.
It will look similar to following after copying:
My Name
And should not be:
<div id="output"><h1>My Name</h1><img src="" /></div>
I have looked at js range, this may be a solution but I cannot identify how to select all of a parent "output"