Default cursor to search bar on page open
I have recently made a new homepage for my company so that employees can access various cloud services such as fleet trackers etc easily.
I also put a google search box on this page so that users would not feel the need to switch back to a search engine for their homepage.
I achieved this by using this form.
<form method="get" action="http://www.google.com/search">
<input type="text" name="q" size="25" maxlength="600" value="" />
<input type="submit" value="Google Search" />
</form>
The only problem is that in google you can visit the page and the search 开发者_如何学编程box is already selected so the user can start typing in their search straight away. On my page the user has to click the search box and then type in the query.
Does anybody know how I can rectify this? Perhaps some handy jquery?
You can use $("input[name='q']").focus()
in the ready
event handler
Update: jsFiddle Example
精彩评论