You can use the JavaScript .select()
method for HTMLElement:
<label for="userid">User ID</label>
<input onClick="this.select();" value="Please enter the user ID" id="userid" />
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" id="userid" />