You can use this javascript snippet:
<input onClick="this.select();" value="Sample Text" />
But apparently it doesn’t work on mobile Safari. In those cases you can use:
<input onClick="this.setSelectionRange(0, this.value.length)" value="Sample Text" />
More Related Contents:
- How to set same value for all the text fields with same name attribute using Javascript?
- How to check the value of input [closed]
- How can i create html automatic change page? [duplicate]
- How do I check whether a checkbox is checked in jQuery?
- Changing website favicon dynamically
- Can Javascript read the source of any web page?
- Reading uploaded text file contents in html
- Any way to clone HTML5 canvas element with its content?
- Using execCommand (Javascript) to copy hidden text to clipboard
- Get IFrame’s document, from JavaScript in main document
- How to get the onclick calling object?
- fetch(), how do you make a non-cached request?
- How to use CSS (and JavaScript?) to create a blurred, “frosted” background?
- How To Determine Which Submit Button Was Pressed, Form onSubmit Event, Without jQuery [duplicate]
- Sharing a variable between multiple html pages
- How to detect element being added/removed from dom element?
- Google Maps: How to create a custom InfoWindow?
- Image manipulation and texture mapping using HTML5 Canvas?
- CSS3-Animate elements if visible in viewport (Page Scroll)
- How to detect support for the HTML5 “download” attribute?
- How to create a responsive image that also scales up in Bootstrap 3
- How to focus on a form input text field on page load using jQuery?
- Drag-and-drop file uploading without AJAX, synchronously in the foreground?
- Append HTML to container element without innerHTML
- How do I make a move up and down when I’m scrolling the page?
- Hide div element when screen size is smaller than a specific size
- HTML/Javascript Button Click Counter
- How to Bootstrap navbar static to fixed on scroll?
- How can I detect a Scrollbar presence ( using Javascript ) in HTML iFrame?
- Geolocation closest location(lat, long) from my position