<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="bbPress/1.0.1" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title>Gravity Support Forums Topic: Clearing default field values with Jquery</title>
		<link>https://legacy.forums.gravityhelp.com/topic/clearing-default-field-values-with-jquery-1</link>
		<description>Gravity Support Forums Topic: Clearing default field values with Jquery</description>
		<language>en-US</language>
		<pubDate>Mon, 20 Apr 2026 10:09:54 +0000</pubDate>
		<generator>http://bbpress.org/?v=1.0.1</generator>
		<textInput>
			<title><![CDATA[Search]]></title>
			<description><![CDATA[Search all topics from these forums.]]></description>
			<name>q</name>
			<link>https://legacy.forums.gravityhelp.com/search.php</link>
		</textInput>
		<atom:link href="https://legacy.forums.gravityhelp.com/rss/topic/clearing-default-field-values-with-jquery-1" rel="self" type="application/rss+xml" />

		<item>
			<title>Chris Hajer on "Clearing default field values with Jquery"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/clearing-default-field-values-with-jquery-1#post-72688</link>
			<pubDate>Sun, 26 Aug 2012 22:20:35 +0000</pubDate>
			<dc:creator>Chris Hajer</dc:creator>
			<guid isPermaLink="false">72688@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;The problem is you loaded the clearit script before jQuery is loaded, so this will never work.  &#60;/p&#62;
&#60;p&#62;Screenshot: &#60;a href=&#34;http://minus.com/lb2FhER2FHIBwh&#34; rel=&#34;nofollow&#34;&#62;http://minus.com/lb2FhER2FHIBwh&#60;/a&#62;&#60;/p&#62;
&#60;p&#62;You need to include this script:&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;[js]
&#38;lt;script type=&#38;quot;text/javascript&#38;quot;&#38;gt;

jQuery(document).ready(function() {

	jQuery.fn.cleardefault = function() {
	return this.focus(function() {
		if( this.value == this.defaultValue ) {
			this.value = &#38;quot;&#38;quot;;
		}
	}).blur(function() {
		if( !this.value.length ) {
			this.value = this.defaultValue;
		}
	});
};
jQuery(&#38;quot;.clearit input, .clearit textarea&#38;quot;).cleardefault();

});

&#38;lt;/script&#38;gt;&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;&#60;strong&#62;after&#60;/strong&#62; jQuery is loaded by the theme.  How did you add that script?  If you just pasted it into header.php, you put it up too high.  It need to be closer to the closing &#38;lt;/head&#38;gt; tag, like right before it actually.  And it certainly needs to be after jQuery is loaded (in other words, your clearit script needs to come after line 41 in the  &#60;a href=&#34;http://minus.com/lb2FhER2FHIBwh&#34; rel=&#34;nofollow&#34;&#62;screenshot&#60;/a&#62;.&#60;/p&#62;
&#60;p&#62;That should get it working for you at least.  However, the proper way to do this is to enqueue this script, only on the pages where you need it (maybe all, since it's a sidebar form) and make sure its dependency of jquery is satisfied before loading.  We can tackle that, if you want, after this is working with the code pasted into the correct place in header.php.  Thank you.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>jblack350 on "Clearing default field values with Jquery"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/clearing-default-field-values-with-jquery-1#post-72669</link>
			<pubDate>Sun, 26 Aug 2012 18:48:49 +0000</pubDate>
			<dc:creator>jblack350</dc:creator>
			<guid isPermaLink="false">72669@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;I am having a little trouble getting the  following tutorial to work on my wordpress theme: &#60;a href=&#34;http://www.gravityhelp.com/clearing-default-form-field-values-with-jquery/&#34; rel=&#34;nofollow&#34;&#62;http://www.gravityhelp.com/clearing-default-form-field-values-with-jquery/&#60;/a&#62; &#60;/p&#62;
&#60;p&#62;The form is on the sidebar for email signup:  &#60;a href=&#34;http://www.mattcarterband.com&#34; rel=&#34;nofollow&#34;&#62;http://www.mattcarterband.com&#60;/a&#62;&#60;/p&#62;
&#60;p&#62;I have added the code snippet to my header file in the head tags and also changed the css class name to &#34;clearit&#34; on the form.  No luck though.  How can I tell if the jQuery library is loaded in my theme?  If it is not, are there tutorials on how to do this?&#60;/p&#62;
&#60;p&#62;Thanks!
&#60;/p&#62;</description>
		</item>

	</channel>
</rss>
