Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8468283
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T15:53:29+00:00 2026-06-10T15:53:29+00:00

Why am I using, or need to use the extra input element with the

  • 0

Why am I using, or need to use the extra input element with the attribute of hidden to make a web site search box that searches the given web site internally.

<div id="search_box">
<form name="searchform" action="http://www.google.com/search" method="get" target="_blank">
<input name="sitesearch" type="hidden" value="www.example.com" />
<input name="as_q" onfocus="this.value=''" type="text" size="20" value="Search www.example.com" title="Enter your search here" />
<input title="Begin Search" type="submit" value="Search" />
</form>
</div>

Additionally do I really need to use Javascript onfocus="this.value=''" to clear the text/value of “Search http://www.example.com&#8221; once the user has clicked on it. Why does this not work which I suspect is due to the fact that one can not “target” some “attribute” via. CSS and there are no “alternative” CSS properties for a given HTML attribute.

input[type="text"]:focus
{
value: "";
}

The above will fail as I can not (or can I?) target the value attribute! But it just seems an overkill to use Javascript for a very small functionality like this one. Almost like using JS for hover effects rather than CSS pseudo:hover.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T15:53:30+00:00Added an answer on June 10, 2026 at 3:53 pm

    Why am I using, or need to use the extra input element with the
    attribute of hidden to make a web site search box that searches the
    given web site internally.

    Somehow you must tell the search engine that you want to limit the search to a specific site. Normally this is done via a hidden input field, since that gets included when the form is submitted but not show to the user.

    However it doesn’t need to be a hidden element. You can put it in a text, radiobutton, checkbox or select too. The only requirement is that it is sent to the search engine with name “sitesearch” and with a value with the website of your choice.

    do I really need to use Javascript onfocus=”this.value=”” to clear
    the text/value of “Search http://www.example.com” once the user has clicked
    on it.

    You can set value='' from the beginning and use the new html5 attribute placeholder='Search www.example.com'. Or use a descriptive text somewhere on the page.

    But it just seems an overkill to use Javascript for a very small
    functionality like this one. Almost like using JS for hover effects
    rather than CSS pseudo:hover.

    You might think of it as overkill, but for years it was the only way to do it. Javascript has been in the browsers long before CSS was implemented. The hover effect had to be implemented in javascript because :hover wasn’t introduced until CSS2. The placeholder effect that you want to use in this case has only recently been implemented with HTML5.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

What do I need to use to get a search listing using the google
Possible Duplicate: Limit file format when using <input type=file>? I need to use the
Using ASP.NET MVC + jQuery : I need to use some values owned by
I need to use multiple hosts under IIS for WCF. We're using wshttpbinding and
I am using director class for scene transitions and i need to use the
I'm using Qt creator 2.4. I need to use a string say hiworld in
I am using Visual Studio 2008, and I need to use certain header files
I have been using mootools for a year now. I need to use jquery
I'm using asp.net mvc 3, My problem is I need to use the customized
Hi i am using struts2 and hibernate in my project. I need to use

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.