Selecting text in input field
var input = document.getElementById("some-input"); Full selection: input.select(); Partial selection (selects second letter): input.setSelectionRange(1, 2); Putting carret in specific places: input.setSelectionRange(0, 0);//Begining of the input field input.setSelectionRange(1, 1);//After first letter To get beginning and end points of the selected text use: input.getSelectionStart input.getSelectionStart To set beginning and end points of the selected text use: input.getSelectionStart =… Read More »