Skip to content

Instantly share code, notes, and snippets.

@levicole
Created April 17, 2011 21:27
Show Gist options
  • Select an option

  • Save levicole/924494 to your computer and use it in GitHub Desktop.

Select an option

Save levicole/924494 to your computer and use it in GitHub Desktop.
simple clearing fields jquery plugin
(function($){
$.fn.clearingField = function(){
return this.each(function(){
var obj = $(this);
var hint = obj.val();
obj.focus(function(){
if(obj.val() == hint){
obj.val("");
}
});
obj.focusout(function(){
if(obj.val() == ''){
obj.val(hint)
}
});
});
};
})(jQuery)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment