javascript select input text on focus

JavaScript
focusMethod = function getFocus() {           
  document.getElementById("myTextField").focus(); //select the input textfield and set the focus on it
}
Source

Also in JavaScript: