HTML
<input id="formloginusername" type="text" name="username" placeholder="Username" value="Pre-filled-from-database"></input>
JS:
$(document).ready(function() {
$("#formloginusername").focus();
});
Problem:
The text "Pre-filled-from-database" is highlighted. I only want the cursor to show in the field as if the user had clicked it after the filled text.
Thanks!
Just this will do:
Here's a nifty little trick...
DEMO: http://jsfiddle.net/X7Y8S/
Hopstream, what I found in Chrome using your method is the cursor ended up at the end of the text. I needed a way to get the cursor focused on the start of the field without highlighting the text. This worked for me: