Focus a cursor in the search field - HotUKDeals
We use cookie files to improve site functionality and personalisation. By continuing to use HotUKDeals, you accept our cookie and privacy policy.
Get the HotUKDeals app free at Google Play

Search Error

An error occurred when searching, please try again!

Login / Sign UpSubmit

Focus a cursor in the search field

£0.00 @
Ive just designed a webstie and the main area is a search box, how do i make the cursor go straight to the search box ready to type when page loads, like google for example... thanks
max401 Avatar
7y, 4m agoPosted 7 years, 4 months ago
Ive just designed a webstie and the main area is a search box, how do i make the cursor go straight to the search box ready to type when page loads, like google for example...

thanks
max401 Avatar
7y, 4m agoPosted 7 years, 4 months ago
Options

All Comments

(12) Jump to unreadPost a comment
Comments/page:
#1
check google's html?

Maybe something like this?

"onload="document.f.q.focus()"
#2
do i put that before /head?
#3
max401
do i put that before /head?


I don't have a clue mate, that's the bit from google's page which looks most likely but you need someone that knows what they're doing. I probably could've worked this out 10 years ago but not anymore!
#4
there is a bit about it here, might help, might not.
#5
catinthehat
there is a bit about it here, might help, might not.
.........although its for forms, so might not.
#6
cant seem to get it working with any of them/... this is my input field and button...





#7
Maybe the smiley in there is causing the problem???
#8


< !-- STEP TWO: Insert the onLoad event handler into your BODY tag -->

< !-- STEP ONE: Paste this code into the BODY of your HTML document -->



< !-- This script and many more are available free online at -->




Name:




Free JavaScripts provided

by The JavaScript Source



< !-- Script Size: 0.61 KB -->

#9
You haven't told us your form name, so replace YOURFORM with the name of your form!











#10
Ambdon
You haven't told us your form name, so replace YOURFORM with the name of your form!



is this it?

#11
Benjimoron


< !-- STEP TWO: Insert the onLoad event handler into your BODY tag -->

< !-- STEP ONE: Paste this code into the BODY of your HTML document -->



< !-- This script and many more are available free online at -->




Name:




Free JavaScripts provided

by The JavaScript Source



< !-- Script Size: 0.61 KB -->



Why don't you just use that???
#12
max401
is this it?



Try changing it to:

Post a Comment

You don't need an account to leave a comment. Just enter your email address. We'll keep it private.

...OR log in with your social account

...OR comment using your social account

Looking for Twitter login?
Thanks for your comment! Keep it up!
We just need to have a quick look and it will be live soon.
The community is happy to hear your opinion! Keep contributing!