A popular effect is to fill a site’s search box with a value (like ‘search…’) and then use jQuery to clear the default value when the field receives focus, reverting if the field is empty when blurred.
$(function(){
//set default value:
$("#searchbox")
.val('search?');
.focus(function(){this.val('')})
.blur(function(){
(this.val() === '')? this.val('search?') : null;
});
});
No comments:
Post a Comment