selected input content code example
Example 1: js select input contents
function selectText() {
const input = document.getElementById('text-box');
input.focus();
input.select();
}
Example 2: javascript select input text on focus
focusMethod = function getFocus() {
document.getElementById("myTextField").focus(); //select the input textfield and set the focus on it
}