Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 2 of 2
  1. #1
    Junior Member
    Join Date
    Feb 2010
    Posts
    10
    Member #
    21183
    Hello WDF,

    I am looking to make a search box in my website. I already have everything setup, along with a default value. When the user loads the webpage, the search box will say "Perform Search...". When the user clicks in the box, I want it to clear.

    So in other words, I want it to go from "Perform Search..." and then when they click on the box it says nothing, or it clears. Similar to what Google does, and even logging in here at WDF. It says "username" and then when you click it, it gets cleared.

    Anyone know how to do this?

    Thanks,
    -Jeff

    [EDIT!!]

    Fixed. I added this to the textbox:

    onclick="this.value='';"

    Thanks.

  2.  

  3. #2
    Senior Member Steax's Avatar
    Join Date
    Dec 2006
    Location
    Bandung, Indonesia
    Posts
    1,207
    Member #
    14572
    There are actually a lot more methods to do so, and sometimes they're necessary to get good user interactions. For example, firefox saves my passwords, so if I used your site, after typing in my username and pressing tab, your script will erase the saved password and makes that feature useless! You also want to style the "hint" so it looks differently from inputted text.

    If you're using jQuery, there are a multitude of plugins that do just that. Take a look at their plugins.
    Note on code: If I give code, please note that it is simply sample code to demonstrate an effect. It is not meant to be used as-is; that is the programmer's job. I am not responsible to give you support or be held liable for anything that happens when using my code.


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 08:34 AM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com