Jon Erickson Jon Erickson - 1 year ago 135
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 Source
$(document).ready(function() {
    $("input:text").focus(function() { $(this).select(); } );
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download