JSFiddle - React, Tailwind, and code Playground

HTML

<script>
    function select1() {
        window.getSelection().selectAllChildren(document.getElementById('p1'));
    }
    function select2() {
        window.getSelection().selectAllChildren(document.getElementById('p2'));
    }
</script>
<p id='p1'><span>this is line1<br></br>this is line2<br></br>this is line3</span></p>
<button style="width: 4em; height: 4em;" onclick="select1()">Select 1~3</button>
<p id='p2'>this is line4<br></br>this is line5<br></br>this is line6</p>
<button style="width: 4em; height: 4em;" onclick="select2()">Select 4~6</button>