<!DOCTYPE html>
<html>
<head>
<title>jQuery select() method</title>
<script src="jquery-latest.min.js"></script>
<script>
$(document).ready(function(){
$("input").select(function(){
$("span").text("Text Selected");
});
$("button").click(function(){
$("input").select();
});
});
</script>
</head>
<body>
Name: <input type="text" value="Christan Ronald" />
<span></span>
<br /><br />
<button id="btn1">Select all text</button>
</body>
</html>