|
| Register now to interact with over 11,000 members! Registered users have Posting Privileges, free access to Private Messaging, Email Notifications and more. |
|
|||||||
![]() |
|
|
Thread Tools | Search this Thread |
|
|
#1 |
|
Join Date: Aug 2004
Location: syracuse
Posts: 322
Reputation: 5
|
Search Bar Question
I have a search bar that says "Search here"
How can I have it so when the user clicks the search bar, the "Search here" text disappears? thanks!! |
|
|
|
|
|
#2 |
|
Join Date: Oct 2002
Location: Dallas
Posts: 2,659
Reputation: 204
|
javascript. Let's say this is your search bar
<input text="search here"> you can put javascript in there to detect when someone focuses on the box <input text="search here" onfocus="this.value=''"> that's this.value='' (two single quotes). Basically, when focus is moved to the control, javascript takes this (the input box) and sets its value to '' (nothing). The negative here is that if someone types something into it, then clicks away, then clicks back, the text gets wiped again. If that becomes a problem (99% of the time it wouldn't be) you can work around it, but I'd probably start moving to a function solution rather than doing it inline in the element. Hope that helps. |
|
|
|
|
|
#3 |
|
Mod.. with bite..
Join Date: Sep 2002
Location: Australia
Posts: 6,630
Reputation: 383
|
Here's an example. The third line specifically.
Code:
|
|
|
|
![]() |
| Thread Tools | Search this Thread |
|
|