One of the most common requests I receive as a WordPress developer is to make it so that a simple form field value clears when a user clicks or focuses on a given field.  Since I use Gravity Forms for just about ever form I create, I would like to provide the following code, which was provided via the Gravity Forms forums:

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();

Note that you will need to add the “clearit” class to each form field via the Gravity Forms back end.


We love to communicate: phone, email, text, Facebook, Twitter, LinkedIn, you name it.



Call Now

Enroll in Our Free Beginner WordPress Class - delivered to your Email Inbox!

Become a WordPress superstar for FREE in only minutes a day!  Our free Beginner WordPress Email Class will be delivered to your inbox!

Learn More 

You Have Successfully Enrolled! Prepare For Amazing!