Java Reference
In-Depth Information
Figure 8.3. Search Here
The problem with this is that the text remains in the field when the the user clicks inside it,
so it has to be deleted before the user can enter their own text. This is easily remedied by
adding these event handlers:
input.addEventListener('focus', function(){
if (input.value==="Search Here") {
input.value = ""
}, false);
input.addEventListener('blur', function(){
if(input.value == "") {
input.value = "Search Here";
} }, false);
Now the default text will disappear when the user clicks inside the input field (the focus
event) and reappear if the users leaves the field blank and clicks away from it (the blur
Search WWH ::

Custom Search