I have a form like so:
<form action='word.php' name = 'searchbox'>
<input type='text' name='word' id = 'searchbox' value = 'default'>
</form>
In my body I have:
<body onLoad="searchbox.word.focus()">
You can see the fiddle here:
http://jsfiddle.net/WEZ7S/
What I’m trying to achieve is just have a blinking cursor at the end of “default”, but instead the whole word gets selected instead.
Surprisingly Google hasn’t been able to find any solutions. How would I do this?
From a previously answered question: https://stackoverflow.com/a/13371452/1238887
Here’s a nifty little trick:
DEMO: http://jsfiddle.net/X7Y8S/