default value onblur and onfocus js for @Html.Textbox

Topics: Writing themes
Dec 25, 2011 at 12:05 AM

I'd like to set the default value for the search textbox ("Search...") and remove and replace it using onblur and onfocus js... somethign like this:

value="Search..." onblur="if (this.value == ''){this.value = 'Search...'; }" onfocus="if (this.value == 'Search...') {this.value = '';}"

I'm pretty clueless with the actual workings of Html helpers and most of C# in general ;) so I'd be stoked on even a link to get a better understanding of what's really going on.
A quick code paste to just get'er done will be helpful and appreciated too.

Thanks and happy holidays to everyone! Wish you all an exciting, healthy and prosperous 2012!
Dec 25, 2011 at 2:19 AM

There are jQuery plug-ins that will do that in a much cleaner way.

Dec 25, 2011 at 2:31 AM

Ya that's what I ended up doing.... Thanks!