Skip to content

Instantly share code, notes, and snippets.

@bawright
Created March 13, 2014 13:09
Show Gist options
  • Select an option

  • Save bawright/9528161 to your computer and use it in GitHub Desktop.

Select an option

Save bawright/9528161 to your computer and use it in GitHub Desktop.
Gravity Forms - Clearing Default Field Values with jQuery

CSS class name: "clearit"

jQuery(document).ready(function() {
jQuery.fn.cleardefault = function() {
return this.focus(function() {
if( this.value == this.defaultValue ) {
this.value = "";
}
}).blur(function() {
if( !this.value.length ) {
this.value = this.defaultValue;
}
});
};
jQuery(".clearit input, .clearit textarea").cleardefault();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment