2 Feb 2011 at 19:59 #1 Vulcan Vulcan Soldato Joined 15 Jan 2004 Posts 10,206 As on Google, when you load the page up, you can start typing in the input straight away without clicking the box. I've done this before but cannot remember how, anyone know?
As on Google, when you load the page up, you can start typing in the input straight away without clicking the box. I've done this before but cannot remember how, anyone know?
2 Feb 2011 at 20:13 #2 Pho Pho Soldato Joined 18 Oct 2002 Posts 9,336 Location Derbyshire In pure JavaScript try the focus() function of an input box: Code: <script type="text/javascript"> document.getElementById('search').focus(); </script> If you use jQuery then use focus: Code: <script type="text/javascript"> $(document).ready(function(){ $("#search").focus(); }); </script>
In pure JavaScript try the focus() function of an input box: Code: <script type="text/javascript"> document.getElementById('search').focus(); </script> If you use jQuery then use focus: Code: <script type="text/javascript"> $(document).ready(function(){ $("#search").focus(); }); </script>
2 Feb 2011 at 20:29 #3 Dj_Jestar Dj_Jestar Caporegime Joined 18 Oct 2002 Posts 29,493 Location Back in East London use window.onload() if going pure JS: Code: window.onload(function(){ document.getElementById("search").focus(); });
use window.onload() if going pure JS: Code: window.onload(function(){ document.getElementById("search").focus(); });