I need to select my HTML content ( as in highlight text so I can copy it). I want to create a button that selects all content between two <div>
or two <p>
(any tag really). Check out codepen for what I need to select.
I have found some selection ideas, but I am not sure (kinda confused)
<input onClick="this.setSelectionRange(0, 9999)" value="Sample Text" />
var range = document.createRange();
var sel = window.getSelection();
range.setStart(el.childNodes[2], 5);
range.collapse(true);
I want it to create range by a two tags.
Thanks for any help