Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>JS Bin</title>
</head>
<body>
  
  <input value="Some Example Text" id="textField">
  <button id="btn">Select Text</button>
</body>
</html>
 
var tf  = document.getElementById('textField'),
    btn = document.getElementById('btn');
btn.onclick = function () {
  // change the numbers to select a different range
  tf.focus();
  tf.setSelectionRange(5, 12);
};
Output 300px

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
ImpressiveWebspro
0viewers