<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Jotlab &#187; input</title>
	<atom:link href="http://www.jotlab.com/tag/input/feed" rel="self" type="application/rss+xml" />
	<link>http://www.jotlab.com</link>
	<description>Just another WordPress site</description>
	<lastBuildDate>Fri, 22 Mar 2013 01:15:26 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<item>
		<title>jQuery &#8211; Clear Default Input Values Once</title>
		<link>http://www.jotlab.com/2010/jquery-clear-default-input-values-once</link>
		<comments>http://www.jotlab.com/2010/jquery-clear-default-input-values-once#comments</comments>
		<pubDate>Fri, 30 Apr 2010 03:01:38 +0000</pubDate>
		<dc:creator>voidet</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[clearing]]></category>
		<category><![CDATA[default]]></category>
		<category><![CDATA[empty]]></category>
		<category><![CDATA[fields]]></category>
		<category><![CDATA[input]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[values]]></category>

		<guid isPermaLink="false">http://www.jotlab.com/?p=4368</guid>
		<description><![CDATA[I like to have default values in my text input fields. However it is an annoying user experience to have to manually clear the value out and then enter in the value. Instead I thought I would write a simple script that would work site... <span><a href="http://www.jotlab.com/2010/jquery-clear-default-input-values-once" title="jQuery &#8211; Clear Default Input Values Once" rel="bookmark">[+]</a></span>]]></description>
				<content:encoded><![CDATA[<p>I like to have default values in my text input fields. However it is an annoying user experience to have to manually clear the value out and then enter in the value. Instead I thought I would write a simple script that would work site wide to clear out the default values. You of course will need your jquery included:</p>
<p>Following some brilliant comments on this there is a much quicker method:</p>
<pre class="brush: jscript; title: ; notranslate">$('input[type=text]').one('focus', function(){
	$(this).attr('value', '');
});</pre>
<p>However the original code I came up with is as follows:</p>
<pre class="brush: jscript; title: ; notranslate">$(function(){
	$('input[type=text]').focus(function(){
		if (!this.clicked) {
			$(this).attr('value', '');
			this.clicked = true;	
		}
	});
});</pre>
<p>This will clear the fields out only once. So if the user enters a value, then focuses back on the field, their values won&#8217;t be cleared. So if they needed to edit a single letter, then their entire entry won&#8217;t be wiped. If you have any hints feel free to comment</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jotlab.com/2010/jquery-clear-default-input-values-once/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
