Select all contents of textbox when it receives focus (Vanilla JS or jQuery)

javascript, jquery, user-interface

Solution

$(document).ready(function() {
    $("input:text").focus(function() { $(this).select(); } );
});

Problem

What is a Vanilla JS or jQuery solution that will select all of the contents of a textbox when the textbox receives focus?

Original source