Created
June 8, 2014 17:37
-
-
Save andyknapp/a7465c4ddd016c0913f5 to your computer and use it in GitHub Desktop.
Remove default value on ::focus in gravity forms
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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