Select-all input

by freedawirl

HTML

<label for="oldSchool">Old jQuery:</label>
<input id="oldSchool" type="text" value="hello" />
<br />
<br />
<label for="whereItsAt">Cutting edge jQuery:</label>
<input id="whereItsAt" type="text" value="hello" />

JavaScript

$("#oldSchool").on("click", function () {
    $(this).select();
});


$("#whereItsAt").click(function () {
    $(this).select();
});