Skip to content

Instantly share code, notes, and snippets.

@michelson
Created July 28, 2010 17:20
Show Gist options
  • Save michelson/495395 to your computer and use it in GitHub Desktop.
Save michelson/495395 to your computer and use it in GitHub Desktop.
// togglea values de inputs
InputValueHelper = $.klass({
initialize: function(){
this.initial_value = $(this.element).val()
},
onblur: function(){
if($(this.element).val() == '') {
$(this.element).val(this.initial_value);
}
},
onfocus: function(){
if($(this.element).val() == this.initial_value) {
$(this.element).val('');
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment