Jon Erickson Jon Erickson - 3 months ago 16
Javascript Question

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

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

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