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

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


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


<input type="text" onfocus="this.select();" onmouseup="return false;" value="test" />