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="Web Tools Weekly" id="textField">
  <button id="btn">Select Text</button>
</body>
</html>
 
body {
  padding: 40px;
}
input {
  display: block;
  width: 260px;
  margin: 0 auto;
  border: none;
  background: #ccc;
  height: 30px;
  border-radius: 6px;
  font-family: Arial, sans-serif;
  text-align: center;
  font-size: 18px;
  margin-top: 20px;
}
button {
  display: block;
  width: 100px;
  margin: 20px auto;
}
 
var tf  = document.getElementById('textField'),
    btn = document.getElementById('btn');
btn.onclick = function () {
  // change the numbers to select a different range
  tf.focus();
  tf.setSelectionRange(4, 9);
};
Output

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

Dismiss x
public
Bin info
ImpressiveWebspro
0viewers