My users are requesting that when they goto my search page, that the cursor already be blinking in the keyword field. Currently you have to click in there with your mouse. Is there an easy way to do this with PHP or even HTML?
At the end of the body, just before the </body> tag, you can use this script.
Keep in mind that this depends on the value of your form identifier, and the name of the search field. In this example, the form has an id of "search" and the search field is called "q"
<input type="text" name="q">
var form = document.getElementById('search');
Would'nt you need to ensure the document was fully loaded first?
Scripts can access anything that appears before them in the DOM.
The standard location to speed up your web pages is to put your scripts at the end of the body, just before the </body> tag. Coincidentally that also means that the whole DOM is available to those scripts as well, which is why putting your scripts at the end of the body has become such a very useful technique.
Ahhh I see, thanks for that.
I wasn't sure how that would work because technically, the body element isn't closed and it would be the root node of any element you would be targeting.
I'm sure you can tell I'm a JS noob.