Is there a way to use alert() or another pop-up to display actual HTML code that? For example, I have the code below:
var range = selection.getRangeAt(0);
var newNode = document.createElement('span');
newNode.setAttribute("class", "selectedText");
range.surroundContents(newNode);
I want to use an alert to display the HTML result of
range.surroundContents(newNode);
It should display something like
<span class='selectedText'>'range will go in here'</span>.
Which is what I want to validate.Thanks!