Just copy and paste the following to your page
You can add and remove a special CSS class and modify the input value
<input type="text" class="hint" value="Search..."
onfocus="if (this.className=='hint') { this.className = ''; this.value = ''; }"
onblur="if (this.value == '') { this.className = 'hint';
this.value = 'Search...'; }">
onfocus/onblur with JS:
Then specify a hint class with the styling you want in your CSS for example:
input.hint {
color: grey;
}
No comments:
Post a Comment