<?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>Brandon Buttars &#187; Javascript</title>
	<atom:link href="http://brandonbuttars.com/category/javascript/feed/" rel="self" type="application/rss+xml" />
	<link>http://brandonbuttars.com</link>
	<description>more like Random Buttars</description>
	<lastBuildDate>Mon, 22 Mar 2010 01:33:07 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>jQuery &#8211; Helpful Default Input Values</title>
		<link>http://brandonbuttars.com/2009/12/jquery-helpful-default-input-values/</link>
		<comments>http://brandonbuttars.com/2009/12/jquery-helpful-default-input-values/#comments</comments>
		<pubDate>Mon, 07 Dec 2009 01:54:19 +0000</pubDate>
		<dc:creator>Brandon Buttars</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://brandonbuttars.com/?p=111</guid>
		<description><![CDATA[I&#8217;ve recently wanted to try and use some different code to add some default values to my input fields, especially the search box.  Most code I&#8217;ve seen does some type of a label overlay which involved a lot of freaking code.  I finally found some code and did a little tweaking to it to fit [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve recently wanted to try and use some different code to add some default values to my input fields, especially the search box.  Most code I&#8217;ve seen does some type of a label overlay which involved a lot of freaking code.  I finally found some code and did a little tweaking to it to fit my situation.  You can also find it under my <a title="jQuery Input Labels" href="http://snipplr.com/view/22483/jquery--addfocusblur-input-value/">Snipplr code</a>.</p>
<p><span id="more-111"></span><code>$(function(){<br />
  $('input[type="text"]').each(function(){<br />
    if(this.value==''){this.value='Enter Value'}<br />
  });<br />
  $('input[type="text"]').focus(function(){<br />
    if(this.value=='Enter Value'){this.value=''}<br />
  });<br />
  $('input[type="text"]').blur(function(){<br />
    if(this.value==''){this.value='Enter Value'}<br />
  });<br />
});</code></p>
<p>The first part of the code identifies that if the value of the input field is empty add &#8216;Enter Value&#8217;.  The second part of the code removes the value &#8216;Enter Value&#8217; from input fields as it gains focus.  The last part of the code adds &#8216;Enter Value&#8217; to empty fields as they lose focus.  This code may not work in every situation, but it can help in some situations.  Let me know how it works and if you found other modifications of the code that work even better.  This is a dependent on jQuery but I&#8217;m sure you may find a version that can adapt to other libraries or straight JavaScript.</p>
]]></content:encoded>
			<wfw:commentRss>http://brandonbuttars.com/2009/12/jquery-helpful-default-input-values/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>CSS HTML Class &#8211; Browser and Operating System</title>
		<link>http://brandonbuttars.com/2009/12/css-html-class-browser-and-operating-system/</link>
		<comments>http://brandonbuttars.com/2009/12/css-html-class-browser-and-operating-system/#comments</comments>
		<pubDate>Mon, 07 Dec 2009 01:32:26 +0000</pubDate>
		<dc:creator>Brandon Buttars</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Javascript]]></category>

		<guid isPermaLink="false">http://brandonbuttars.com/?p=104</guid>
		<description><![CDATA[I was trying to find a good snippet of code that would help me style the different browsers better.  I&#8217;ve used all the attribute hacks before but one thing I&#8217;ve run into lately is the fact that Chrome and Safari end up interpreting and displaying input tags differently even though they are both Webkit based. [...]]]></description>
			<content:encoded><![CDATA[<p>I was trying to find a good snippet of code that would help me style the different browsers better.  I&#8217;ve used all the attribute hacks before but one thing I&#8217;ve run into lately is the fact that <strong>Chrome and Safari end up interpreting and displaying input tags differently even though they are both Webkit based. </strong>There were not individual attribute hacks that I could find, but I was able to find this beauty over at <a title="CSS HTML Class Creator" href="http://github.com/rafaelp/css_browser_selector">http://github.com/rafaelp/css_browser_selector</a>.  I&#8217;ve also added the code to my <a href="http://snipplr.com/users/smoothdzion/" title="My Snipplr Arsenal">Snipplr Arsenal</a> so you can get it over at <a href="http://snipplr.com/view/23988/adds-os-and-browser-class-to-html-tag/" title="CSS Browser/OS Identifier">http://snipplr.com/view/23988/adds-os-and-browser-class-to-html-tag/</a></p>
<p><span id="more-104"></span><code>/*<br />
CSS Browser Selector v0.3.4 (Sep 29, 2009)<br />
Rafael Lima (http://rafael.adm.br)</p>
<p>http://rafael.adm.br/css_browser_selector</p>
<p>License: http://creativecommons.org/licenses/by/2.5/<br />
Contributors: http://rafael.adm.br/css_browser_selector#contributors<br />
*/<br />
function css_browser_selector(u){var ua = u.toLowerCase(),is=function(t){return ua.indexOf(t)&gt;-1;},g='gecko',w='webkit',s='safari',o='opera',h=document.getElementsByTagName('html')[0],b=[(!(/opera|webtv/i.test(ua))&amp;&amp;/msie\s(\d)/.test(ua))?('ie ie'+RegExp.$1):is('firefox/2')?g+' ff2':is('firefox/3.5')?g+' ff3 ff3_5':is('firefox/3')?g+' ff3':is('gecko/')?g:is('opera')?o+(/version\/(\d+)/.test(ua)?' '+o+RegExp.$1:(/opera(\s|\/)(\d+)/.test(ua)?' '+o+RegExp.$2:'')):is('konqueror')?'konqueror':is('chrome')?w+' chrome':is('iron')?w+' iron':is('applewebkit/')?w+' '+s+(/version\/(\d+)/.test(ua)?' '+s+RegExp.$1:''):is('mozilla/')?g:'',is('j2me')?'mobile':is('iphone')?'iphone':is('ipod')?'ipod':is('mac')?'mac':is('darwin')?'mac':is('webtv')?'webtv':is('win')?'win':is('freebsd')?'freebsd':(is('x11')||is('linux'))?'linux':'','js']; c = b.join(' '); h.className += ' '+c; return c;}; css_browser_selector(navigator.userAgent);</code></p>
<p>That code makes it so I can even validate my CSS and get rid of my attribute hacks.  The code adds a bunch of different classes to your HTML tag.  It adds the Operating System, the Browser, the Browser Version, and if Javascript is enabled or not.  You can do a lot with that info.  I was able to then create a Chrome specific style for my stylesheet.  Love this code.  It has been added to my regular arsenal of code.</p>
<p>Just include that code in your head or reference it as a separate file in your head.  I prefer a separate file, but to each their own.</p>
]]></content:encoded>
			<wfw:commentRss>http://brandonbuttars.com/2009/12/css-html-class-browser-and-operating-system/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
