this is going to be a total newbie question but I can’t really do a google search cos I’m not sure what it’s called.
You know that the quick search bar on the top right hand corner in StackOverFlow?
You know how it’s got “search” written there, and when you click on it, it goes blank, what’s the best way to implement this?
I see the javascript has this in stackoverflow.
onfocus="if (this.value=='search') this.value = ''" value="search"
But if I have a seperate search button, and the user doesn’t focus on that search criteria (it’s got multiple search criterias), I would need to take the “search” into account.
I would need to do something like
if(textbox1.Text == "search")
{
textbox1.Text = "";
}
That just seems a bit annoying having to put the text (“search”) in 3 places. Twice in the markup and once in the code behind.
Is there another way of doing this?
Not sure if it’s overkill, but I ended up using the telerik rad textbox instead.
And it worked okay.