<?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"
	>
<channel>
	<title>Comments on: Default Text Field Values That Disappear on&#160;Focus</title>
	<atom:link href="http://hocuspokus.net/2008/05/16/default-text-field-values-that-disappear-on-focus/feed/" rel="self" type="application/rss+xml" />
	<link>http://hocuspokus.net/feeder/?FeederAction=clicked&amp;feed=Articles+%28RSS2%29&amp;seed=http%3A%2F%2Fhocuspokus.net%2F2008%2F05%2F16%2Fdefault-text-field-values-that-disappear-on-focus%2F&amp;seed_title=Default+Text+Field+Values+That+Disappear+on%26%23160%3BFocus</link>
	<description>the life and times of a code monkey</description>
	<pubDate>Mon, 01 Dec 2008 17:39:09 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.5</generator>
		<item>
		<title>By: Dominic Claxton</title>
		<link>http://hocuspokus.net/feeder/?FeederAction=clicked&amp;feed=Articles+%28RSS2%29&amp;seed=http%3A%2F%2Fhocuspokus.net%2F2008%2F05%2F16%2Fdefault-text-field-values-that-disappear-on-focus%2F&amp;seed_title=Default+Text+Field+Values+That+Disappear+on%26%23160%3BFocus#comment-483</link>
		<dc:creator>Dominic Claxton</dc:creator>
		<pubDate>Fri, 24 Oct 2008 14:23:53 +0000</pubDate>
		<guid isPermaLink="false">http://hocuspokus.net/?p=146#comment-483</guid>
		<description>I changed it slightly to work even better (in my opinion!)
Remove the focus entirely from the links and instead trigger from the javascript.
This should allow you to make the default text disappear on focus but when the user types in and then refocuses on it again it doesn't disapperar but merely highlights. This gives the user the option of continuing to type by clicking again. For me it works better. 
Try it!

Tested in FireFox 2 and IE7
Here it is in full.

&lt;pre lang="javascript"&gt;
var active_color = '#000'; // Colour of user provided text
var inactive_color = '#999'; // Colour of default text
 
$(document).ready(function() {
	   
    $("input.default-value").css("color", inactive_color);
    var default_values = new Array();					   
						   
    $('input[type="text"]').focus(function() {
        if (this.value == this.defaultValue){
	    this.value = '';
            this.style.color = active_color;
	}
	if(this.value != this.defaultValue){
	    this.select(); 
	    this.style.color = active_color;
	}
    });
    $('input[type="text"]').blur(function() {
        if (this.value == ''){
	    this.value = (this.defaultValue ? this.defaultValue : '');
	    this.style.color = inactive_color;
	}
    });
}
&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>I changed it slightly to work even better (in my opinion!)<br />
Remove the focus entirely from the links and instead trigger from the javascript.<br />
This should allow you to make the default text disappear on focus but when the user types in and then refocuses on it again it doesn&#8217;t disapperar but merely highlights. This gives the user the option of continuing to type by clicking again. For me it works better.<br />
Try it!</p>
<p>Tested in FireFox 2 and IE7<br />
Here it is in full.</p>

<div class="wp_syntax"><div class="code"><pre class="javascript javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">var</span> active_color <span style="color: #339933;">=</span> <span style="color: #3366CC;">'#000'</span>; <span style="color: #006600; font-style: italic;">// Colour of user provided text</span>
<span style="color: #003366; font-weight: bold;">var</span> inactive_color <span style="color: #339933;">=</span> <span style="color: #3366CC;">'#999'</span>; <span style="color: #006600; font-style: italic;">// Colour of default text</span>
&nbsp;
$<span style="color: #009900;">&#40;</span>document<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">ready</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
    $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;input.default-value&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">css</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;color&quot;</span><span style="color: #339933;">,</span> inactive_color<span style="color: #009900;">&#41;</span>;
    <span style="color: #003366; font-weight: bold;">var</span> default_values <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> Array<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;					   
&nbsp;
    $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'input[type=&quot;text&quot;]'</span><span style="color: #009900;">&#41;</span>.<span style="color: #000066;">focus</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">value</span> <span style="color: #339933;">==</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">defaultValue</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
	    <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">value</span> <span style="color: #339933;">=</span> <span style="color: #3366CC;">''</span>;
            <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">style</span>.<span style="color: #660066;">color</span> <span style="color: #339933;">=</span> active_color;
	<span style="color: #009900;">&#125;</span>
	<span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">value</span> <span style="color: #339933;">!=</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">defaultValue</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
	    <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">select</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>; 
	    <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">style</span>.<span style="color: #660066;">color</span> <span style="color: #339933;">=</span> active_color;
	<span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span>;
    $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'input[type=&quot;text&quot;]'</span><span style="color: #009900;">&#41;</span>.<span style="color: #000066;">blur</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">value</span> <span style="color: #339933;">==</span> <span style="color: #3366CC;">''</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
	    <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">value</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">defaultValue</span> <span style="color: #339933;">?</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">defaultValue</span> <span style="color: #339933;">:</span> <span style="color: #3366CC;">''</span><span style="color: #009900;">&#41;</span>;
	    <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">style</span>.<span style="color: #660066;">color</span> <span style="color: #339933;">=</span> inactive_color;
	<span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span>;
<span style="color: #009900;">&#125;</span></pre></div></div>

]]></content:encoded>
	</item>
	<item>
		<title>By: Tahir</title>
		<link>http://hocuspokus.net/feeder/?FeederAction=clicked&amp;feed=Articles+%28RSS2%29&amp;seed=http%3A%2F%2Fhocuspokus.net%2F2008%2F05%2F16%2Fdefault-text-field-values-that-disappear-on-focus%2F&amp;seed_title=Default+Text+Field+Values+That+Disappear+on%26%23160%3BFocus#comment-479</link>
		<dc:creator>Tahir</dc:creator>
		<pubDate>Thu, 23 Oct 2008 06:43:15 +0000</pubDate>
		<guid isPermaLink="false">http://hocuspokus.net/?p=146#comment-479</guid>
		<description>Great example Andy; I've borrowed it for my site with one change.  Once a user entered their information into the text-field I didn't want the script to remove the users content when clicked again.  So here is the change:

&lt;pre lang="javascript"&gt;
$(document).ready(function(){
    $('input[type="text"]').focus(function() {
        if (this.value == this.defaultValue) this.value = '';
    });
    $('input[type="text"]').blur(function() {
        if (this.value == '') this.value = (this.defaultValue ? this.defaultValue : '');
    });
});
&lt;/pre&gt;

Thanks again for the example.  It was a huge helper for a jQuery Newbie who had no idea where to start!</description>
		<content:encoded><![CDATA[<p>Great example Andy; I&#8217;ve borrowed it for my site with one change.  Once a user entered their information into the text-field I didn&#8217;t want the script to remove the users content when clicked again.  So here is the change:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript javascript" style="font-family:monospace;">$<span style="color: #009900;">&#40;</span>document<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">ready</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
    $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'input[type=&quot;text&quot;]'</span><span style="color: #009900;">&#41;</span>.<span style="color: #000066;">focus</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">value</span> <span style="color: #339933;">==</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">defaultValue</span><span style="color: #009900;">&#41;</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">value</span> <span style="color: #339933;">=</span> <span style="color: #3366CC;">''</span>;
    <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span>;
    $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'input[type=&quot;text&quot;]'</span><span style="color: #009900;">&#41;</span>.<span style="color: #000066;">blur</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">value</span> <span style="color: #339933;">==</span> <span style="color: #3366CC;">''</span><span style="color: #009900;">&#41;</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">value</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">defaultValue</span> <span style="color: #339933;">?</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">defaultValue</span> <span style="color: #339933;">:</span> <span style="color: #3366CC;">''</span><span style="color: #009900;">&#41;</span>;
    <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span>;
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span>;</pre></div></div>

<p>Thanks again for the example.  It was a huge helper for a jQuery Newbie who had no idea where to start!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Vignesh Sugumar</title>
		<link>http://hocuspokus.net/feeder/?FeederAction=clicked&amp;feed=Articles+%28RSS2%29&amp;seed=http%3A%2F%2Fhocuspokus.net%2F2008%2F05%2F16%2Fdefault-text-field-values-that-disappear-on-focus%2F&amp;seed_title=Default+Text+Field+Values+That+Disappear+on%26%23160%3BFocus#comment-476</link>
		<dc:creator>Vignesh Sugumar</dc:creator>
		<pubDate>Tue, 21 Oct 2008 17:50:37 +0000</pubDate>
		<guid isPermaLink="false">http://hocuspokus.net/?p=146#comment-476</guid>
		<description>Here is another working solution!

Asp Textbox


For simple html
</description>
		<content:encoded><![CDATA[<p>Here is another working solution!</p>
<p>Asp Textbox</p>
<p>For simple html</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ryan</title>
		<link>http://hocuspokus.net/feeder/?FeederAction=clicked&amp;feed=Articles+%28RSS2%29&amp;seed=http%3A%2F%2Fhocuspokus.net%2F2008%2F05%2F16%2Fdefault-text-field-values-that-disappear-on-focus%2F&amp;seed_title=Default+Text+Field+Values+That+Disappear+on%26%23160%3BFocus#comment-426</link>
		<dc:creator>Ryan</dc:creator>
		<pubDate>Tue, 26 Aug 2008 00:29:55 +0000</pubDate>
		<guid isPermaLink="false">http://hocuspokus.net/?p=146#comment-426</guid>
		<description>Great example Andy; I've borrowed it for my site with one change.  Once a user entered their information into the text-field I didn't want the script to remove the users content when clicked again.  So here is the change:

&lt;pre lang="javascript"&gt;
$(document).ready(function(){
    $('input[type="text"]').focus(function() {
        if (this.value == this.defaultValue) this.value = '';
    });
    $('input[type="text"]').blur(function() {
        if (this.value == '') this.value = (this.defaultValue ? this.defaultValue : '');
    });
});
&lt;/pre&gt;

Thanks again for the example.  It was a huge helper for a jQuery Newbie who had no idea where to start!</description>
		<content:encoded><![CDATA[<p>Great example Andy; I&#8217;ve borrowed it for my site with one change.  Once a user entered their information into the text-field I didn&#8217;t want the script to remove the users content when clicked again.  So here is the change:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript javascript" style="font-family:monospace;">$<span style="color: #009900;">&#40;</span>document<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">ready</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
    $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'input[type=&quot;text&quot;]'</span><span style="color: #009900;">&#41;</span>.<span style="color: #000066;">focus</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">value</span> <span style="color: #339933;">==</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">defaultValue</span><span style="color: #009900;">&#41;</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">value</span> <span style="color: #339933;">=</span> <span style="color: #3366CC;">''</span>;
    <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span>;
    $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'input[type=&quot;text&quot;]'</span><span style="color: #009900;">&#41;</span>.<span style="color: #000066;">blur</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">value</span> <span style="color: #339933;">==</span> <span style="color: #3366CC;">''</span><span style="color: #009900;">&#41;</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">value</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">defaultValue</span> <span style="color: #339933;">?</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">defaultValue</span> <span style="color: #339933;">:</span> <span style="color: #3366CC;">''</span><span style="color: #009900;">&#41;</span>;
    <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span>;
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span>;</pre></div></div>

<p>Thanks again for the example.  It was a huge helper for a jQuery Newbie who had no idea where to start!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Daz</title>
		<link>http://hocuspokus.net/feeder/?FeederAction=clicked&amp;feed=Articles+%28RSS2%29&amp;seed=http%3A%2F%2Fhocuspokus.net%2F2008%2F05%2F16%2Fdefault-text-field-values-that-disappear-on-focus%2F&amp;seed_title=Default+Text+Field+Values+That+Disappear+on%26%23160%3BFocus#comment-410</link>
		<dc:creator>Daz</dc:creator>
		<pubDate>Thu, 24 Jul 2008 18:09:23 +0000</pubDate>
		<guid isPermaLink="false">http://hocuspokus.net/?p=146#comment-410</guid>
		<description>&lt;blockquote&gt;This could be made simpler by assigning a custom property to the object in the DOM. I've called it "defaultValue". Does not address the colour change, but again, it could be assigned as a custom property if necessary.&lt;/blockquote&gt;

Ta!  That's just a little more concise, great example.  :)</description>
		<content:encoded><![CDATA[<blockquote><p>This could be made simpler by assigning a custom property to the object in the DOM. I&#8217;ve called it &#8220;defaultValue&#8221;. Does not address the colour change, but again, it could be assigned as a custom property if necessary.</p></blockquote>
<p>Ta!  That&#8217;s just a little more concise, great example.  <img src='http://hocuspokus.net/wp-content/plugins/smilies-themer/tango/face-smile.png' alt=':)' class='wp-smiley' /></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Andy</title>
		<link>http://hocuspokus.net/feeder/?FeederAction=clicked&amp;feed=Articles+%28RSS2%29&amp;seed=http%3A%2F%2Fhocuspokus.net%2F2008%2F05%2F16%2Fdefault-text-field-values-that-disappear-on-focus%2F&amp;seed_title=Default+Text+Field+Values+That+Disappear+on%26%23160%3BFocus#comment-409</link>
		<dc:creator>Andy</dc:creator>
		<pubDate>Thu, 24 Jul 2008 17:00:23 +0000</pubDate>
		<guid isPermaLink="false">http://hocuspokus.net/?p=146#comment-409</guid>
		<description>Even better, defaultValue is already part of the DOM. I always forget that... So here is a more slimline jQuery powered version

&lt;pre lang="javascript"&gt;$('input[type="text"]').focus(function() {
  this.value = '';
});
$('input[type="text"]').blur(function() {
  if (this.value == '') this.value = (this.defaultValue ? this.defaultValue : '');
});&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>Even better, defaultValue is already part of the DOM. I always forget that&#8230; So here is a more slimline jQuery powered version</p>

<div class="wp_syntax"><div class="code"><pre class="javascript javascript" style="font-family:monospace;">$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'input[type=&quot;text&quot;]'</span><span style="color: #009900;">&#41;</span>.<span style="color: #000066;">focus</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">value</span> <span style="color: #339933;">=</span> <span style="color: #3366CC;">''</span>;
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span>;
$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'input[type=&quot;text&quot;]'</span><span style="color: #009900;">&#41;</span>.<span style="color: #000066;">blur</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">value</span> <span style="color: #339933;">==</span> <span style="color: #3366CC;">''</span><span style="color: #009900;">&#41;</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">value</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">defaultValue</span> <span style="color: #339933;">?</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">defaultValue</span> <span style="color: #339933;">:</span> <span style="color: #3366CC;">''</span><span style="color: #009900;">&#41;</span>;
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span>;</pre></div></div>

]]></content:encoded>
	</item>
	<item>
		<title>By: Andy</title>
		<link>http://hocuspokus.net/feeder/?FeederAction=clicked&amp;feed=Articles+%28RSS2%29&amp;seed=http%3A%2F%2Fhocuspokus.net%2F2008%2F05%2F16%2Fdefault-text-field-values-that-disappear-on-focus%2F&amp;seed_title=Default+Text+Field+Values+That+Disappear+on%26%23160%3BFocus#comment-408</link>
		<dc:creator>Andy</dc:creator>
		<pubDate>Thu, 24 Jul 2008 14:03:01 +0000</pubDate>
		<guid isPermaLink="false">http://hocuspokus.net/?p=146#comment-408</guid>
		<description>This could be made simpler by assigning a custom property to the object in the DOM. I've called it "defaultValue". Does not address the colour change, but again, it could be assigned as a custom property if necessary.

&lt;pre lang="javascript"&gt;$('input[type="text"]').focus(function() {
  if (!this.defaultValue) this.defaultValue = value;
});
$('input[type="text"]').blur(function() {
  if (this.value == '') this.value = (this.defaultValue ? this.defaultValue : '');
});&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>This could be made simpler by assigning a custom property to the object in the DOM. I&#8217;ve called it &#8220;defaultValue&#8221;. Does not address the colour change, but again, it could be assigned as a custom property if necessary.</p>

<div class="wp_syntax"><div class="code"><pre class="javascript javascript" style="font-family:monospace;">$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'input[type=&quot;text&quot;]'</span><span style="color: #009900;">&#41;</span>.<span style="color: #000066;">focus</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">defaultValue</span><span style="color: #009900;">&#41;</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">defaultValue</span> <span style="color: #339933;">=</span> value;
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span>;
$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'input[type=&quot;text&quot;]'</span><span style="color: #009900;">&#41;</span>.<span style="color: #000066;">blur</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">value</span> <span style="color: #339933;">==</span> <span style="color: #3366CC;">''</span><span style="color: #009900;">&#41;</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">value</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">defaultValue</span> <span style="color: #339933;">?</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">defaultValue</span> <span style="color: #339933;">:</span> <span style="color: #3366CC;">''</span><span style="color: #009900;">&#41;</span>;
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span>;</pre></div></div>

]]></content:encoded>
	</item>
	<item>
		<title>By: cd</title>
		<link>http://hocuspokus.net/feeder/?FeederAction=clicked&amp;feed=Articles+%28RSS2%29&amp;seed=http%3A%2F%2Fhocuspokus.net%2F2008%2F05%2F16%2Fdefault-text-field-values-that-disappear-on-focus%2F&amp;seed_title=Default+Text+Field+Values+That+Disappear+on%26%23160%3BFocus#comment-378</link>
		<dc:creator>cd</dc:creator>
		<pubDate>Tue, 17 Jun 2008 02:49:11 +0000</pubDate>
		<guid isPermaLink="false">http://hocuspokus.net/?p=146#comment-378</guid>
		<description>if u want simple input text who will disapear when u focus ypur cursor on it just use this
 
&lt;pre lang="html4strict"&gt;&lt;input onfocus="this.value=''" type="text" value="some text" /&gt;&lt;/pre&gt;

or this

&lt;pre lang="html4strict"&gt;&lt;input onfocus="this.select()" type="text" value="some text" /&gt;&lt;/pre&gt;
</description>
		<content:encoded><![CDATA[<p>if u want simple input text who will disapear when u focus ypur cursor on it just use this</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">input</span> <span style="color: #000066;">onfocus</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;this.value=''&quot;</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text&quot;</span> <span style="color: #000066;">value</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;some text&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span></pre></div></div>

<p>or this</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">input</span> <span style="color: #000066;">onfocus</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;this.select()&quot;</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text&quot;</span> <span style="color: #000066;">value</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;some text&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span></pre></div></div>

]]></content:encoded>
	</item>
</channel>
</rss>

<!-- Dynamic Page Served (once) in 0.864 seconds -->
