Pilih Not Input Elements Text JS

document.querySelector('button').addEventListener('click', function(){
    var range = document.createRange();
    var selection = window.getSelection();
    range.selectNodeContents(document.querySelector('p')); // the element want to select it's content
    
    selection.removeAllRanges();
    selection.addRange(range);
});

// https://developer.mozilla.org/en-US/docs/Web/API/range/selectNodeContents
FADL