38 How Add Blog Search Box Code To Blogger

How to add a search box to your blogger,as default template doesn't provide any search codes or search box in your template so as readers can search of in your blog or web from your blog.There are many methods of adding search box to your blog at different places you want and different types of codes for search which you want to be done in our blog.Now i will explain where to add these codes and what codes to add to make a seach box in your blog.

Lets first of all start with the search codes which you need to add in your blog. The codes are below:-

First


<form id="searchThis" action="/search" style="display:inline;" method="get"><input id="searchBox" name="q" type="text"/> <input id="searchButton" value="Go" type="submit"/></form>


Change the text in red to any text like search or hit you want to display in button to hit the search.

Your search box will appear like this below.



Second

If you want to add some styling like this new sample below:-




Use these codes


<form id="searchthis" action="/search" style="display:inline;" method="get">
<input id="search-box" name="q" size="25" type="text" style="background: #ccccff; border: 2px solid #000066"><input id="search-btn" value="Search" type="submit" style="background: #000066; border: 2px outset #ff0000; color: #ffffff; font-weight: bold;"></form>


Edit the colors or styling in red in above codes to change the styling of search box to adjust in your template.

Third

Now if you want to add image in place of search button like below:-



Use these codes:-


<form id="searchthis" action="/search" style="display:inline;" method="get">
<input id="search-box" name="q" size="25" type="text" value="Enter search terms"><input id="search-btn" value="Search" type="image" src="http://www.iconlet.com/icons/crystal09/16x16/search.png" style="margin-left: 5px; margin: 3px 0 0 5px;"/></form>


Change the image url in red above with the url of the image you want to use.and hope you would have no problem in using any of the codes.

Now How To place search Box at different places in blogger blog:-

To Place it in sidebar:-

Under Template->Page Elements tab, click “Add a Page Element” at the place where you want your search box to appear.
Select HTML/JavaScript and add the above codes.

If you want to place search box in header read this tuorial Embed search Box In Blogger Header.

I hope you will love this tutorial.
If you liked This Just Subscribe With US to Get Recent Widgets, Hacks And Templates To your Inbox.
Share/Bookmark

38

Jahz said...

VERY AWESOME DUDE THX AND MORE POWER!

March 19, 2009 5:36 PM
B.Tech ebooks said...

its very good
and its working also

thank you very much

April 5, 2009 12:20 PM
Anonymous said...

Thanks for the tutorial ..

April 11, 2009 1:26 PM
fresh365 said...

Very easy! Thank you!

April 22, 2009 7:36 PM
Philip Kennedy said...

Cheers for this!

May 8, 2009 11:19 PM
Gabbi said...

So helpful! Thank you...

May 25, 2009 4:17 AM
The Krew said...

thx. for the excellent tutorial!!!

June 4, 2009 3:06 AM
yourhypnotist said...

Thanks this added the final touch

October 5, 2009 10:32 PM
SATHEESH KUMAR K said...

I have one doubt. i created 10 blogs in blogspot. in these blogs one as home page other as sub pages, But problem is as these are separate blogs, each one has their own search. So can u provide me search box code, that has capability of search more than one blog.

like when user search in home blog. it has to search in remaining all 9 blogs that i hav created. is it possible? Please suggest me

October 13, 2009 10:12 AM
Tomasse said...

This is very helpfull...especially how to change the style (i didnt know this)...but i have a question, if you could help me, i would really appreciate it... how can i position the search bar to whichever place/position of the blogger i want...i mean, is there a code, that defines the position of the search bar?
This is my blog: http://universumest.blogspot.com/
this is where i want to place the search bar: http://i463.photobucket.com/albums/qq358/raidenjunior/dsfsdfs.jpg

Thank you very much in advance!!!

October 17, 2009 12:44 AM
Grace said...

Thanks so much for this! I've been looking for a way to do this for a while and yours was simple and easy. A few other codes did not work (from other sites) maybe because I am using tumblr...so I was happy to find this. Thanks again! --Grace

November 3, 2009 4:45 AM
Piscean said...

Awosome ..thnx

November 24, 2009 7:04 PM
Attaullah khan said...

its not working in my blog, starting this code working properly but its not working. only one post result shown another results not shown. you can check also my blog postings in i think 170 posts. http://www.hollywood-boxoffice.blogspot.com

December 16, 2009 2:25 AM
Anilkumar said...

its not working on my site

January 10, 2010 11:24 AM
thepoal said...

thanks....

January 25, 2010 1:19 PM
Manuel said...

Hi Anshul,
I have a default search box in my blogger template. And after changing to a custom domain search is now totally dis functional. Can you help me in this. I know this is a bit off topic, but still if you could help me, it would have been really helpful.

February 22, 2010 10:41 AM
Anshul said...

@manuel i saw your codes.See this line
input class='textfield' name='q' size='24' type='text' value=''

make like this
input class='textfield' name='q' size='24' type='text' value='' id='s'

February 22, 2010 1:19 PM
Moderator said...

Its working but can I adjust the box height? I can only resize its width, not the height. Please reply fast!

February 26, 2010 12:46 PM
Anshul said...

@moderator see the second search code i have told that is blue color seach box.
And now see below codes what i have done is added height property only and now can increade heignt.

<form id="searchthis" action="/search" style="display:inline;" method="get">
<input id="search-box" name="q" size="25" type="text" style="background: #ccccff; border: 2px solid #000066;height:30px;"/><input id="search-btn" value="Search" type="submit" style="background: #000066; border: 2px outset #ff0000; color: #ffffff; font-weight: bold;"/></form>

February 26, 2010 4:50 PM
Moderator said...

Thanks anshul! It works perfectly. One more thing, I have added the search box on my header right next to RSS feed links (see for yourself at http://unitybond.blogspot.com) and made the background transparent.

Here's the prob, when I make the background transparent, the words inside the search box can't really be seen (cause its black). Is there any chance that I change just the font color?

February 26, 2010 8:18 PM
Anshul said...

@moderator i can't see any search box in your template but any how i saw it and understood your problem.Just as how i added height:30px; add this propery also there color:#fff; then it will become white.

February 27, 2010 12:37 AM
Moderator said...

Anshul, really sorry to trouble but whenever I try to add the code u said above, it keep showing Attribute name "color:" associated with an element type "input" must be followed by the ' = ' character. and also Open quote is expected for attribute "{1}" associated with an element type "color:".

Would u mind help me to edit the code? I just want the font in white while the background transparent. I can't put the embed codes here cause your blogger comment don't allow it.

Thanks a billion! By the way, my McAfee SiteAdvisor show me warnings about your site linked to Ziddu.com which poses browser breach. Hope u can look around.

February 27, 2010 4:45 AM
Gina said...

Mine doesn't work. I recently got a custom domain name and it stopped working. Could it have something to do with that? Is there a way I could fix it?

February 27, 2010 7:05 PM
Gina said...

I'm having the same problem, mine doesn't work. I recently got a custom domain, could it have something to do with that? I never had a problem before. How can I fix this? www.skinnytaste.com

February 27, 2010 7:06 PM
Anshul said...

@moderator you have to add it in style so add it just after height:30px;color:#fff; like this then it will accept.

@gina ya as you switched to domain so urls chnaged.So when they will all be indexed by google then will show up in search results.

February 27, 2010 11:49 PM
Linus Brännström said...

Hi,

I have one problem with my search box – when I search for something it only shows results from posts on my front page, like the eight latest posts.

Do you have any idea what that's about?

Thank you.

February 28, 2010 5:48 PM
Anshul said...

@linus you have added google custom search i cant say may be you would have made some settings while making it.

March 1, 2010 10:21 AM
Linus Brännström said...

Hi, yeah I know I got the Google custom search now. That one works ok.

But the question was about your search box code.
I removed the search box I got from your site just because of the problem I mentioned – that it only showed posts from the front page.

March 1, 2010 1:39 PM
ZOE RAYMOND said...

Hi Anshul, is it possible to have the search my blog codes that shows the names and few sentences of the posts instead of showing whole posts? Cause of the new blogger arrangement, i can only show 1-2 posts per page which defeats the purpose of putting a seach my blog function! Thanks! (:

March 1, 2010 1:53 PM
Anshul said...

@linus mine codes are fine as every one uses same codes and all templates have search inbuild like this.

@zoe ya i think for this if you you will show only post title on label pages hack may provide you solution for this.You can find for it in my blog.

March 2, 2010 3:47 PM
ZOE RAYMOND said...

Thanks Anshul for the quick revert! You mean you have the codes for "search this blog" that displays just titled and a few words of each post instead of the current whole posts reflected?

March 2, 2010 7:00 PM
HQ Collections said...

Hey Great post man thank u very much.

March 5, 2010 6:40 PM
buxer said...

If I want the header of the search box, how I write the code.

The header like " Search:□Go!
□=search box

March 10, 2010 10:35 AM
Anshul said...

change this value n codes to any value="Search"
Just replace search with go

March 10, 2010 10:40 AM
Evelina said...

I have a problem with custom domain. Search box does'nt work. Any ideas? www.patiks.lt

March 10, 2010 1:59 PM
blue said...

Thank you! I kept finding directions on how to do it for the new templates style, but I'm using a Classic Template style, so this was perfect.

March 13, 2010 5:38 AM
HACKER said...

buddy this not helping me !

as this or any other search box of your tutorial is not able to search for the specific or any posts in my blog , u can check for ur self after visiting my blog !

please help !

the problem occured after i changed my blog url from http://swaranisking.blogspot.com to http://goooglehacker.blogspot.com, now even the default search box which blogger provides and which is the best which i like is not working so please help me !

will be waiting for ur answer !

thanks !

March 14, 2010 12:03 PM
Anshul said...

@hacker ya u changed url so it will take ime unless all your posts on new name are indexed well then it will start searching.It can take months.

March 16, 2010 4:18 PM