Skip to content

Instantly share code, notes, and snippets.

@andyknapp
Created June 8, 2014 17:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andyknapp/a7465c4ddd016c0913f5 to your computer and use it in GitHub Desktop.
Save andyknapp/a7465c4ddd016c0913f5 to your computer and use it in GitHub Desktop.
Remove default value on ::focus in gravity forms
jQuery(document).ready(function($) {
$('.gform_wrapper input[type=text], .gform_wrapper input[type=email], .gform_wrapper textarea, .gform_wrapper input[type=tel]').each(function() {
$.data(this, 'default', this.value);
}).focus(function() {
if ($.data(this, 'default') == this.value) {
this.value = '';
$(this).addClass('focus-value');
}
}).blur(function() {
if (this.value == '') {
this.value = $.data(this, 'default');
$(this).removeClass('focus-value');
}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment