I have a search box (textbox) and I want to clear it’s content when I click inside. (some kind of watermark. Watermark control was not good for me in this case).
I am using “onKeyDown” event to clear the content:
function clearTbSearch(tbSearch) {
if (tbSearch != null && tbSearch.value == '<%= TypeHereText %>') {
tbSearch.value = "";
tbSearch.style.color = "#000000";
}
return true;
}
It works fine in IE and Chrome but in Firefox it takes 3 (!!!) clicks to get it focused. First click does not do anything. The second one clears the textbox but do not focus. The third click get the cursor focused. I tried anything… I would be glad for any suggestions…
Thanks!!!
You can try this to make it look cleaner: