<?xml version="1.0" encoding="UTF-8"?><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"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Tutorial: Clearing the Textarea value onFocus</title>
	<atom:link href="http://designwoop.com/2009/12/clearing-form-textarea-value-onfocus/feed/" rel="self" type="application/rss+xml" />
	<link>http://designwoop.com/2009/12/clearing-form-textarea-value-onfocus/</link>
	<description>The Web design blog brought to you by Stu Greenham</description>
	<lastBuildDate>Tue, 07 Sep 2010 08:08:51 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
	<item>
		<title>By: Ahmed A.</title>
		<link>http://designwoop.com/2009/12/clearing-form-textarea-value-onfocus/#comment-27107</link>
		<dc:creator>Ahmed A.</dc:creator>
		<pubDate>Sun, 01 Aug 2010 07:08:55 +0000</pubDate>
		<guid isPermaLink="false">http://designwoop.com/?p=606#comment-27107</guid>
		<description>Hey Martin, you saved my life :)   the code works perfectly. I just like to mention that you MUST load jQuery library first:

&lt;code&gt;

&lt;/code&gt;</description>
		<content:encoded><![CDATA[<p>Hey Martin, you saved my life :)   the code works perfectly. I just like to mention that you MUST load jQuery library first:</p>
<p><code></p>
<p></code></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Viktor Edholm</title>
		<link>http://designwoop.com/2009/12/clearing-form-textarea-value-onfocus/#comment-25057</link>
		<dc:creator>Viktor Edholm</dc:creator>
		<pubDate>Sat, 09 Jan 2010 22:09:17 +0000</pubDate>
		<guid isPermaLink="false">http://designwoop.com/?p=606#comment-25057</guid>
		<description>Great tutorial! I myself would use Martin&#039;s method because it fits my workflow better, when I build a websites backend and structure I don&#039;t care about details such as textarea focus and his method allows me to be more efficent when adding it afterwards.</description>
		<content:encoded><![CDATA[<p>Great tutorial! I myself would use Martin&#8217;s method because it fits my workflow better, when I build a websites backend and structure I don&#8217;t care about details such as textarea focus and his method allows me to be more efficent when adding it afterwards.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Stu Greenham</title>
		<link>http://designwoop.com/2009/12/clearing-form-textarea-value-onfocus/#comment-25035</link>
		<dc:creator>Stu Greenham</dc:creator>
		<pubDate>Fri, 08 Jan 2010 13:55:09 +0000</pubDate>
		<guid isPermaLink="false">http://designwoop.com/?p=606#comment-25035</guid>
		<description>Thanks for your comment, I am going to update this code so that the value re-appears if no text is entered like Martin said previously, just haven&#039;t got around to it yet :)</description>
		<content:encoded><![CDATA[<p>Thanks for your comment, I am going to update this code so that the value re-appears if no text is entered like Martin said previously, just haven&#8217;t got around to it yet :)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Stu Greenham</title>
		<link>http://designwoop.com/2009/12/clearing-form-textarea-value-onfocus/#comment-25034</link>
		<dc:creator>Stu Greenham</dc:creator>
		<pubDate>Fri, 08 Jan 2010 13:53:41 +0000</pubDate>
		<guid isPermaLink="false">http://designwoop.com/?p=606#comment-25034</guid>
		<description>Yeah sorry about that I need to get my comments code rendering looked at thanks for spotting it tho! :)</description>
		<content:encoded><![CDATA[<p>Yeah sorry about that I need to get my comments code rendering looked at thanks for spotting it tho! :)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Evan Sharp</title>
		<link>http://designwoop.com/2009/12/clearing-form-textarea-value-onfocus/#comment-25016</link>
		<dc:creator>Evan Sharp</dc:creator>
		<pubDate>Thu, 07 Jan 2010 17:06:14 +0000</pubDate>
		<guid isPermaLink="false">http://designwoop.com/?p=606#comment-25016</guid>
		<description>^fieldset^</description>
		<content:encoded><![CDATA[<p>^fieldset^</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Evan Sharp</title>
		<link>http://designwoop.com/2009/12/clearing-form-textarea-value-onfocus/#comment-25015</link>
		<dc:creator>Evan Sharp</dc:creator>
		<pubDate>Thu, 07 Jan 2010 17:05:34 +0000</pubDate>
		<guid isPermaLink="false">http://designwoop.com/?p=606#comment-25015</guid>
		<description>... damn that html rendering! I even used &#039;code&#039; tags! Arg!</description>
		<content:encoded><![CDATA[<p>&#8230; damn that html rendering! I even used &#8216;code&#8217; tags! Arg!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Evan Sharp</title>
		<link>http://designwoop.com/2009/12/clearing-form-textarea-value-onfocus/#comment-25014</link>
		<dc:creator>Evan Sharp</dc:creator>
		<pubDate>Thu, 07 Jan 2010 17:04:59 +0000</pubDate>
		<guid isPermaLink="false">http://designwoop.com/?p=606#comment-25014</guid>
		<description>@Stu,
My mistake, I should have been paying more attention when climbing on my horse (note the timestamp of my first comment...).

All the same, (and I know its a prickly issue which I don&#039;t want to poke myself with here), I&#039;m a &lt;code&gt;&lt;/code&gt; kind of guy anyway.

Great use of the DOM for the behaviour regardless.</description>
		<content:encoded><![CDATA[<p>@Stu,<br />
My mistake, I should have been paying more attention when climbing on my horse (note the timestamp of my first comment&#8230;).</p>
<p>All the same, (and I know its a prickly issue which I don&#8217;t want to poke myself with here), I&#8217;m a <code></code> kind of guy anyway.</p>
<p>Great use of the DOM for the behaviour regardless.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jeevan Takhar</title>
		<link>http://designwoop.com/2009/12/clearing-form-textarea-value-onfocus/#comment-25001</link>
		<dc:creator>Jeevan Takhar</dc:creator>
		<pubDate>Thu, 07 Jan 2010 01:14:07 +0000</pubDate>
		<guid isPermaLink="false">http://designwoop.com/?p=606#comment-25001</guid>
		<description>Hi Stu,

You may want to add a check that only clears the element if its content matches the default value. This prevents text written by the user being cleared upon a subsequent focus event.</description>
		<content:encoded><![CDATA[<p>Hi Stu,</p>
<p>You may want to add a check that only clears the element if its content matches the default value. This prevents text written by the user being cleared upon a subsequent focus event.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Stu Greenham</title>
		<link>http://designwoop.com/2009/12/clearing-form-textarea-value-onfocus/#comment-24999</link>
		<dc:creator>Stu Greenham</dc:creator>
		<pubDate>Wed, 06 Jan 2010 23:54:35 +0000</pubDate>
		<guid isPermaLink="false">http://designwoop.com/?p=606#comment-24999</guid>
		<description>Thanks Martin for this! I will be sure to give it a try myself! Appreciated!</description>
		<content:encoded><![CDATA[<p>Thanks Martin for this! I will be sure to give it a try myself! Appreciated!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Martin</title>
		<link>http://designwoop.com/2009/12/clearing-form-textarea-value-onfocus/#comment-24985</link>
		<dc:creator>Martin</dc:creator>
		<pubDate>Wed, 06 Jan 2010 04:56:29 +0000</pubDate>
		<guid isPermaLink="false">http://designwoop.com/?p=606#comment-24985</guid>
		<description>This is the code I use for clearing a default value, it is almost like Adam&#039;s code, except it restores the default value on blur if the user left the field empty...

&lt;pre&gt;&lt;code&gt;
$(function() {
	$(&#039;input, textarea&#039;).each(function() {
		var field = $(this);
		var default_value = field.val();
		
		field.focus(function() {
			if (field.val() == default_value) {
				field.val(&#039;&#039;);
			}
		});
		
		field.blur(function() {
			if (field.val() == &#039;&#039;) {
				field.val(default_value);
			}
		});
	});
});
&lt;/code&gt;&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>This is the code I use for clearing a default value, it is almost like Adam&#8217;s code, except it restores the default value on blur if the user left the field empty&#8230;</p>
<pre><code>
$(function() {
	$('input, textarea').each(function() {
		var field = $(this);
		var default_value = field.val();

		field.focus(function() {
			if (field.val() == default_value) {
				field.val('');
			}
		});

		field.blur(function() {
			if (field.val() == '') {
				field.val(default_value);
			}
		});
	});
});
</code></pre>
]]></content:encoded>
	</item>
</channel>
</rss>
