<?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>benwatts.ca &#187; jquery</title>
	<atom:link href="http://www.benwatts.ca/tag/jquery/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.benwatts.ca</link>
	<description>The crazy ramblings of designer/web developer Ben Watts.</description>
	<lastBuildDate>Sat, 02 Jan 2010 22:31:52 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1-alpha</generator>
		<item>
		<title>jQuery Input Text Replacement</title>
		<link>http://www.benwatts.ca/2008/07/19/jquery-input-text-replacement/</link>
		<comments>http://www.benwatts.ca/2008/07/19/jquery-input-text-replacement/#comments</comments>
		<pubDate>Sat, 19 Jul 2008 18:55:33 +0000</pubDate>
		<dc:creator>Ben</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[function]]></category>
		<category><![CDATA[jquery]]></category>

		<guid isPermaLink="false">http://localhost/benwatts.ca/?p=141</guid>
		<description><![CDATA[Thought I&#8217;d save this handy dandy function for later. Makes the text in an input disappear when you click on the input. // the function: function textReplacement&#40;input&#41;&#123; &#160;var originalvalue = input.val&#40;&#41;; &#160;input.focus&#40; function&#40;&#41;&#123; &#160; if&#40; $.trim&#40;input.val&#40;&#41;&#41; == originalvalue &#41;&#123; input.val&#40;''&#41;; &#125; &#160;&#125;&#41;; &#160;input.blur&#40; function&#40;&#41;&#123; &#160; if&#40; $.trim&#40;input.val&#40;&#41;&#41; == '' &#41;&#123; input.val&#40;originalvalue&#41;; &#125; &#160;&#125;&#41;; &#125; // [...]]]></description>
			<content:encoded><![CDATA[<p>Thought I&#8217;d save this handy dandy function for later.<br />
Makes the text in an input disappear when you click on the input.</p>
<div class="codecolorer-container javascript " style="overflow:auto;white-space:nowrap;width:540px"><div class="javascript codecolorer" style="font-family:Monaco,Lucida Console,monospace"><span class="co1">// the function:</span><br />
<span class="kw2">function</span> textReplacement<span class="br0">&#40;</span>input<span class="br0">&#41;</span><span class="br0">&#123;</span><br />
&nbsp;<span class="kw2">var</span> originalvalue <span class="sy0">=</span> input.<span class="me1">val</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp;input.<span class="kw3">focus</span><span class="br0">&#40;</span> <span class="kw2">function</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#123;</span><br />
&nbsp; <span class="kw1">if</span><span class="br0">&#40;</span> $.<span class="me1">trim</span><span class="br0">&#40;</span>input.<span class="me1">val</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#41;</span> <span class="sy0">==</span> originalvalue <span class="br0">&#41;</span><span class="br0">&#123;</span> input.<span class="me1">val</span><span class="br0">&#40;</span><span class="st0">''</span><span class="br0">&#41;</span><span class="sy0">;</span> <span class="br0">&#125;</span><br />
&nbsp;<span class="br0">&#125;</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp;input.<span class="kw3">blur</span><span class="br0">&#40;</span> <span class="kw2">function</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#123;</span><br />
&nbsp; <span class="kw1">if</span><span class="br0">&#40;</span> $.<span class="me1">trim</span><span class="br0">&#40;</span>input.<span class="me1">val</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#41;</span> <span class="sy0">==</span> <span class="st0">''</span> <span class="br0">&#41;</span><span class="br0">&#123;</span> input.<span class="me1">val</span><span class="br0">&#40;</span>originalvalue<span class="br0">&#41;</span><span class="sy0">;</span> <span class="br0">&#125;</span><br />
&nbsp;<span class="br0">&#125;</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
<span class="br0">&#125;</span></div></div>
<div class="codecolorer-container javascript " style="overflow:auto;white-space:nowrap;width:540px"><div class="javascript codecolorer" style="font-family:Monaco,Lucida Console,monospace"><span class="co1">// how to use:</span><br />
textReplacement<span class="br0">&#40;</span>$<span class="br0">&#40;</span><span class="st0">'#inputname'</span><span class="br0">&#41;</span><span class="br0">&#41;</span><span class="sy0">;</span></div></div>
<p><script type="text/javascript">function textReplacement(input){var originalvalue = input.val();input.focus( function(){if( $.trim(input.val()) == originalvalue ){ input.val(''); }});input.blur( function(){if( $.trim(input.val()) == '' ){ input.val(originalvalue); }});}$(document).ready( function(){textReplacement($('#inputname'));});</script></p>
<p>Example:</p>
<input id="inputname" value="Click to Disappear" style="padding: 3px; width: 200px;"  />
]]></content:encoded>
			<wfw:commentRss>http://www.benwatts.ca/2008/07/19/jquery-input-text-replacement/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>jQuery Random Colour Generator</title>
		<link>http://www.benwatts.ca/2008/01/31/jquery-random-colour-generator/</link>
		<comments>http://www.benwatts.ca/2008/01/31/jquery-random-colour-generator/#comments</comments>
		<pubDate>Thu, 31 Jan 2008 16:26:35 +0000</pubDate>
		<dc:creator>Ben</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[sandbox]]></category>
		<category><![CDATA[jquery]]></category>

		<guid isPermaLink="false">http://www.benwatts.ca/?p=12</guid>
		<description><![CDATA[I can&#8217;t remember the inspiration for this crazy thing, but I&#8217;m sure somewhere out there someone is looking for a random colour generator that is done in jQuery. So if you&#8217;re feeling in the mood to have a randomly changing colour &#8230; this is the script for you! Essentially it&#8217;s just generating a random number [...]]]></description>
			<content:encoded><![CDATA[<p>I can&#8217;t remember the inspiration for this crazy thing, but I&#8217;m sure somewhere out there someone is looking for a random colour generator that is done in jQuery.</p>
<p>So if you&#8217;re feeling in the mood to have a randomly changing colour &#8230; this is the script for you! Essentially it&#8217;s just generating a random number between 0 and 255 for red, green, and blue. It then uses CSS to change the colour property of an element (that&#8217;s easily customizable by you).</p>
<p>So <a href="/sandbox/jquery-colourific/">check out the demo</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.benwatts.ca/2008/01/31/jquery-random-colour-generator/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
	</channel>
</rss>
