Ask Dave Taylor
  • Facebook
  • Instagram
  • Linkedin
  • Pinterest
  • Twitter
  • YouTube
  • Home
  • YouTube Channel
  • Most Popular
  • Newsletter!
  • Ask Me A Question
  • Meet Dave
  • Home
  • HTML & Web Page Design
  • Add a YouTube search box to my site?

Add a YouTube search box to my site?

June 11, 2010 / Dave Taylor / HTML & Web Page Design, YouTube Help / 2 Comments

I want to add a YouTube search box to my Web site. Can it be done?

  ★ ASKDAVETAYLOR WEEKLY EMAIL! ★
Guaranteed to Make you Smarter.
Click Here to Subscribe.

Can it be done? Pshaw! Anything can be built or reverse engineered given the time and motivation!
There’s no reason to think that Google’s YouTube site is any different.
The question is: is it going to be an easy reverse engineering job or a tough one, and that can be quickly ascertained by simply having a peek at the YouTube home page:

youtube home page search box

As you can see, it’s a rudimentary search box with the input field and a submit button. That’s it.
Should be quite easy to reverse engineer it!
To start, we’ll crack open the source code to the page and isolate the HTML for the search itself:
youtube search box source code html

Looks like a lot of code, but if we scrub all the non-essential code and replace the fancy, attractive button with a regular HTML “submit” button, we’re left with the small HTML snippet:

<form action=”http://www.youtube.com/results” method=”get”>
<input name=”search_query” type=”text”>
<input type=”submit”>
</form>

That’s it. Seriously. It’s not pretty, but it’s functional:

Now let’s make it a bit nicer looking by adding a box around it. This can be most easily done with some CSS styling within a “div” container, like this:

<div style=”border:2px dotted black;padding:7px;”>
<form action=”http://www.youtube.com/results” method=”get”>
<input name=”search_query” type=”text”>
<input type=”submit”>
</form>
</div>

That gives us this:

What do you think? Want something a wee bit more fancy? How about adding a background color to the box, and a different background color to the (larger) text input field and, for good luck, a third color for the button itself:

<div style=”border:2px dotted black;padding:7px;background-color:#cfc;”>
<form action=”http://www.youtube.com/results” method=”get”>
<b>Search YouTube for: </b>
<input name=”search_query” type=”text” style=”background-color:#ccf;” size=”45″>
<input type=”submit” style=”background-color:#ffc;”>
</form>
</div>

The result:

Search YouTube for:

You can tweak and fiddle from here as you’d like, but that’ll get you the rudiments of a YouTube search box on your site and a direction to travel for a custom fit. Good luck!

Enjoy watching videos? I've got hundreds of lively and interesting product reviews you can enjoy with just a click. Please check 'em out: AskDaveTaylor Video Gallery.

About the Author: Dave Taylor has been involved with the online world since the early days of the Internet. Author of over 20 technical books, he runs the popular AskDaveTaylor.com tech help site. You can also find his gadget reviews on YouTube and chat with him on X as @DaveTaylor.

Let’s Stay In Touch!

Never miss a single article, review or tutorial here on AskDaveTaylor, sign up for my fun weekly newsletter!
Name: 
Your email address:*
Please enter all required fields
Correct invalid entries
No spam, ever. Promise. Powered by FeedBlitz
Please choose a color:
Starbucks coffee cup I do have a lot to say, and questions of my own for that matter, but first I'd like to say thank you, Dave, for all your helpful information by buying you a cup of coffee!

2 comments on “Add a YouTube search box to my site?”

  1. pawan says:
    March 12, 2017 at 1:30 am

    but it opens youtube website in another tab ..i want to display it into div block

    Reply
  2. Steve says:
    June 14, 2010 at 3:47 pm

    Great little trick, far neater way to integrate YouTube into sites!

    Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Search

Recent Posts

  • How to Update the Software on your KOBO Ebook Reader
  • How to Change Your Default Web Browser in Windows
  • How to Check for Spam DM’s in Facebook Messenger
  • How to Automatically Close Your Garage Door with MyQ App
  • Best Time to Post on Facebook Business Pages?

On Our YouTube Channel

Endless Cleaning with the Roborock Q10 S5+ Robot Vacuum & Mop

Cleer ARC 4 Open Ear Headphones: Ideal for Outdoors - DEMO & REVIEW

Categories

  • AdSense, AdWords, and PPC Help (106)
  • AI and ChatGPT Help (75)
  • Alexa, Kindle, and Nook Help (112)
  • Amazon, eBay, and Online Shopping Help (176)
  • Android Help (321)
  • Apple iPad Help (156)
  • Apple Watch & Smartwatch Help (63)
  • Articles, Tutorials, and Reviews (361)
  • Auto Tech Help (31)
  • Business Advice (202)
  • Chromebook & ChromeOS Help (80)
  • Computer & Internet Basics (847)
  • d) None of the Above (169)
  • Facebook Help (405)
  • Google, Chrome & Gmail Help (227)
  • HTML & Web Page Design (249)
  • Instagram, Bluesky & Threads Help (70)
  • iPhone & iOS Help (702)
  • iPod & MP3 Player Help (173)
  • LinkedIn Help (98)
  • Linux Help (182)
  • Linux Shell Script Programming (95)
  • Mac & MacOS Help (994)
  • Microsoft Outlook and Office 365 Help (53)
  • Most Popular (16)
  • PayPal Help (69)
  • Pinterest Help (58)
  • Reddit Help (24)
  • SEO & Marketing (83)
  • Spam, Scams & Security (130)
  • Trade Show News & Updates (23)
  • Video Game Tips (66)
  • Web Site Traffic Tips (62)
  • Windows PC Help (1,093)
  • Wordpress Help (207)
  • Writing and Publishing (72)
  • X/Twitter Help (233)
  • YouTube Help (54)
  • YouTube Video Reviews (159)
  • Zoom, Skype & Video Chat Help (80)

Archives

Social Connections:

Ask Dave Taylor


Follow Me on Pinterest
Follow me on Twitter
Follow me on LinkedIn
Follow me on Instagram


AskDaveTaylor on Facebook



microsoft insider mvp


This web site is for the purpose of disseminating information for educational purposes, free of charge, for the benefit of all visitors. We take great care to provide quality information. However, we do not guarantee, and accept no legal liability whatsoever arising from or connected to, the accuracy, reliability, currency or completeness of any material contained on this site or on any linked site. Further, please note that by submitting a question or comment you're agreeing to our terms of service, which are: you relinquish any subsequent rights of ownership to your material by submitting it on this site. Our lawyer says "Thanks for your cooperation."
© 2025 by Dave Taylor. "Ask Dave Taylor®" is a registered trademark of Intuitive Stories, LLC.
FTC Notice: If you buy products through links on this site we may receive a modest affiliate commission. This won’t affect the price you pay.
Privacy Policy - Terms and Conditions - Accessibility Policy - Humix Video Content
  • Home
  • YouTube Channel
  • Most Popular
  • Newsletter!
  • Ask Me A Question
  • Meet Dave