trampolinejoe Posted February 16, 2009 Share Posted February 16, 2009 Hello Guys, I know this isnt php related its more html based, but can anybody tell me how to have a text box automatically selected when a page loads? I have looked at tabindex but it seems that tabindex is more for ordering the page rather then autoselecting. As in the flasher is already in the box ready to start typing. (refer to google as an example) Sorry if I asked this question in the wrong fourm Quote Link to comment Share on other sites More sharing options...
haku Posted February 16, 2009 Share Posted February 16, 2009 Give your textarea an id like this: <textarea id="target"></textarea> And add this javascript to the head of your document. <script type="text/javascript"> window.onload = function() { document.getElementById('target').focus() } </script> Quote Link to comment Share on other sites More sharing options...
trampolinejoe Posted February 16, 2009 Author Share Posted February 16, 2009 Hey Man! Thanks that worked great! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.