Use this:
var textInput = document.querySelector("input"); textInput.onclick = function() { textInput.selectionStart = 0; textInput.selectionEnd = textInput.value.length; } <input type="text"> Use this:
var textInput = document.querySelector("input"); textInput.onclick = function() { textInput.selectionStart = 0; textInput.selectionEnd = textInput.value.length; } <input type="text">