<?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: jQuery clear focus function</title>
	<atom:link href="http://www.eggchops.com/web-stuff/jquery/jquery-clear-focus-function/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.eggchops.com/web-stuff/jquery/jquery-clear-focus-function/</link>
	<description>The noble ramblings of an eggChop</description>
	<lastBuildDate>Mon, 01 Nov 2010 16:07:23 -0400</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.3</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Madmartigan</title>
		<link>http://www.eggchops.com/web-stuff/jquery/jquery-clear-focus-function/comment-page-1/#comment-31820</link>
		<dc:creator>Madmartigan</dc:creator>
		<pubDate>Mon, 01 Nov 2010 16:07:23 +0000</pubDate>
		<guid isPermaLink="false">http://www.eggchops.com/?p=217#comment-31820</guid>
		<description>Won&#039;t the blur function change the input value when you move focus to the submit button?

Seems like this probably doesn&#039;t work irl</description>
		<content:encoded><![CDATA[<p>Won&#8217;t the blur function change the input value when you move focus to the submit button?</p>
<p>Seems like this probably doesn&#8217;t work irl</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: John Robinson</title>
		<link>http://www.eggchops.com/web-stuff/jquery/jquery-clear-focus-function/comment-page-1/#comment-4649</link>
		<dc:creator>John Robinson</dc:creator>
		<pubDate>Sat, 06 Feb 2010 19:27:22 +0000</pubDate>
		<guid isPermaLink="false">http://www.eggchops.com/?p=217#comment-4649</guid>
		<description>One of the great features of jQuery is the ability to chain events. To save on a few bytes of characters the entire script can be condensed to:

$(document).ready(function () {
	$(&quot;.searchinput&quot;).focus(function () {
		if ($(this).val() === $(this).attr(&quot;title&quot;)) {
			$(this).val(&quot;&quot;);
		}
	}).blur(function () {
		if ($(this).val() === &quot;&quot;) {
			$(this).val($(this).attr(&quot;title&quot;));
		}
	});
});</description>
		<content:encoded><![CDATA[<p>One of the great features of jQuery is the ability to chain events. To save on a few bytes of characters the entire script can be condensed to:</p>
<p>$(document).ready(function () {<br />
	$(&#8221;.searchinput&#8221;).focus(function () {<br />
		if ($(this).val() === $(this).attr(&#8221;title&#8221;)) {<br />
			$(this).val(&#8221;");<br />
		}<br />
	}).blur(function () {<br />
		if ($(this).val() === &#8220;&#8221;) {<br />
			$(this).val($(this).attr(&#8221;title&#8221;));<br />
		}<br />
	});<br />
});</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sam</title>
		<link>http://www.eggchops.com/web-stuff/jquery/jquery-clear-focus-function/comment-page-1/#comment-2838</link>
		<dc:creator>Sam</dc:creator>
		<pubDate>Wed, 16 Sep 2009 13:39:03 +0000</pubDate>
		<guid isPermaLink="false">http://www.eggchops.com/?p=217#comment-2838</guid>
		<description>Thanks, helped me a ton :).</description>
		<content:encoded><![CDATA[<p>Thanks, helped me a ton <img src='http://www.eggchops.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> .</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Translation Services</title>
		<link>http://www.eggchops.com/web-stuff/jquery/jquery-clear-focus-function/comment-page-1/#comment-1715</link>
		<dc:creator>Translation Services</dc:creator>
		<pubDate>Fri, 26 Jun 2009 12:35:20 +0000</pubDate>
		<guid isPermaLink="false">http://www.eggchops.com/?p=217#comment-1715</guid>
		<description>Thnaks for that!I had the same issue with one of my sites!I love Internet!</description>
		<content:encoded><![CDATA[<p>Thnaks for that!I had the same issue with one of my sites!I love Internet!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: James</title>
		<link>http://www.eggchops.com/web-stuff/jquery/jquery-clear-focus-function/comment-page-1/#comment-189</link>
		<dc:creator>James</dc:creator>
		<pubDate>Wed, 06 May 2009 09:26:36 +0000</pubDate>
		<guid isPermaLink="false">http://www.eggchops.com/?p=217#comment-189</guid>
		<description>&lt;a href=&quot;#comment-31&quot; rel=&quot;nofollow&quot;&gt;@eep&lt;/a&gt;

Thanks for this example - I&#039;m just getting started with JQuery so this kind of thing really helps.

After some fiddling around I found that this didn&#039;t work for me:

$(this).val() = $(this).attr(&#039;title&#039;);

But this did:

$(this).val($(this).attr(&#039;title&#039;));</description>
		<content:encoded><![CDATA[<p><a href="#comment-31" rel="nofollow">@eep</a></p>
<p>Thanks for this example &#8211; I&#8217;m just getting started with JQuery so this kind of thing really helps.</p>
<p>After some fiddling around I found that this didn&#8217;t work for me:</p>
<p>$(this).val() = $(this).attr(&#8217;title&#8217;);</p>
<p>But this did:</p>
<p>$(this).val($(this).attr(&#8217;title&#8217;));</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: eggChops</title>
		<link>http://www.eggchops.com/web-stuff/jquery/jquery-clear-focus-function/comment-page-1/#comment-33</link>
		<dc:creator>eggChops</dc:creator>
		<pubDate>Wed, 22 Apr 2009 12:48:25 +0000</pubDate>
		<guid isPermaLink="false">http://www.eggchops.com/?p=217#comment-33</guid>
		<description>&lt;a href=&quot;#comment-31&quot; rel=&quot;nofollow&quot;&gt;@eep&lt;/a&gt; 
Yes I could have done that....I&#039;m not all too sure why I didn&#039;t as I have used &#039;attr&#039; to get the title already...strange :)</description>
		<content:encoded><![CDATA[<p><a href="#comment-31" rel="nofollow">@eep</a><br />
Yes I could have done that&#8230;.I&#8217;m not all too sure why I didn&#8217;t as I have used &#8216;attr&#8217; to get the title already&#8230;strange <img src='http://www.eggchops.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: eep</title>
		<link>http://www.eggchops.com/web-stuff/jquery/jquery-clear-focus-function/comment-page-1/#comment-31</link>
		<dc:creator>eep</dc:creator>
		<pubDate>Tue, 21 Apr 2009 22:03:56 +0000</pubDate>
		<guid isPermaLink="false">http://www.eggchops.com/?p=217#comment-31</guid>
		<description>Instead of creating the variable and doing this:
$(this).val(clearMePrevious);

you could just do this:
$(this).val() = $(this).attr(’title’);</description>
		<content:encoded><![CDATA[<p>Instead of creating the variable and doing this:<br />
$(this).val(clearMePrevious);</p>
<p>you could just do this:<br />
$(this).val() = $(this).attr(’title’);</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: eggChops</title>
		<link>http://www.eggchops.com/web-stuff/jquery/jquery-clear-focus-function/comment-page-1/#comment-29</link>
		<dc:creator>eggChops</dc:creator>
		<pubDate>Sun, 19 Apr 2009 10:45:27 +0000</pubDate>
		<guid isPermaLink="false">http://www.eggchops.com/?p=217#comment-29</guid>
		<description>That&#039;s a different solution. I&#039;m not sure it&#039;s that intuitive though. I think I would expect the field to clear when I clicked inside it so I could start typing. I find myself trying to select the label and clear it rather than start typing over it.</description>
		<content:encoded><![CDATA[<p>That&#8217;s a different solution. I&#8217;m not sure it&#8217;s that intuitive though. I think I would expect the field to clear when I clicked inside it so I could start typing. I find myself trying to select the label and clear it rather than start typing over it.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nic</title>
		<link>http://www.eggchops.com/web-stuff/jquery/jquery-clear-focus-function/comment-page-1/#comment-28</link>
		<dc:creator>Nic</dc:creator>
		<pubDate>Sun, 19 Apr 2009 03:23:39 +0000</pubDate>
		<guid isPermaLink="false">http://www.eggchops.com/?p=217#comment-28</guid>
		<description>I do this one better: by positioning the label over the field instead of putting the label in the field as text, I can leave the label there even while the field has focus, hiding it only when the user actually enters text. See for example the search field at http://foneshow.com/</description>
		<content:encoded><![CDATA[<p>I do this one better: by positioning the label over the field instead of putting the label in the field as text, I can leave the label there even while the field has focus, hiding it only when the user actually enters text. See for example the search field at <a href="http://foneshow.com/" rel="nofollow">http://foneshow.com/</a></p>
]]></content:encoded>
	</item>
</channel>
</rss>

