<?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; jQuery</title>
	<atom:link href="http://brandonbuttars.com/category/jquery/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 Select Options IE Cut Off</title>
		<link>http://brandonbuttars.com/2009/09/css-select-options-internet-explorer-cut-off/</link>
		<comments>http://brandonbuttars.com/2009/09/css-select-options-internet-explorer-cut-off/#comments</comments>
		<pubDate>Wed, 16 Sep 2009 17:26:13 +0000</pubDate>
		<dc:creator>Brandon Buttars</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[Fix]]></category>
		<category><![CDATA[Internet Explorer]]></category>

		<guid isPermaLink="false">http://brandonbuttars.com/?p=92</guid>
		<description><![CDATA[So I&#8217;ve been working for the last couple of days on a bug at work that is an IE specific bug but may actually help with other browsers in different circumstances.  I&#8217;m surprised I haven&#8217;t run into this bug sooner than I had.  I first read a great article on css-tricks.com that I [...]]]></description>
			<content:encoded><![CDATA[<p>So I&#8217;ve been working for the last couple of days on a bug at work that is an IE specific bug but may actually help with other browsers in different circumstances. <strong> I&#8217;m surprised I haven&#8217;t run into this bug sooner than I had.</strong>  I first read a great article on css-tricks.com that I borrowed the screenshot from to illustrate the issue.  Their method was good but not exactly what I was looking for.  So I decided to come up with my own code.</p>
<p><span id="more-92"></span><div id="attachment_101" class="wp-caption aligncenter" style="width: 580px"><img src="http://brandonbuttars.com/wp-content/uploads/2009/09/selectproblem.png" alt="Select Problem with IE" title="Select Problem with IE" width="570" height="387" class="size-full wp-image-101" /><p class="wp-caption-text">Select Problem with IE</p></div>
<p>Most of you probably ran into this article because you are half bald trying to figure out how to make your select box options show their full text in Internet Explorer when the select option has a static size set.  Like the figure above illustrates, looks simple to fix but holy cow did it take a lot of research to figure out the best way to do it.  After hours of research, I found out that I can&#8217;t do it with CSS alone.  Many solutions I saw out there used Javascript and injected CSS in the Javascript.  I&#8217;m not a big fan of CSS in Javascript.  I&#8217;d rather have my CSS separate and change the way something looks in the stylesheet.  For that reason <strong>I find myself using jQuery&#8217;s addClass, removeClass, toggleClass, and toggle quite often.</strong>  That is what this code is going to do for you.  I don&#8217;t think this is the best way for everyone, but it is the best way for me.</p>
<p>I&#8217;m not a programmer per say so I stick to the different code libraries.  I am a jQuery man so my <strong>code requires <a href="http://jquery.com" title="jQuery">jQuery</a></strong>.  So Here is my code and I&#8217;ll explain after you see it.</p>
<pre>

    $(function() {
      $('select').focus(function(){
        $(this).addClass('ie_select');
      });
      $('select').blur(function(){
        $(this).removeClass('ie_select');
      });
    });
</pre>
<p>Place that code in the head of your document <strong>wrapped in a script tag</strong> or however you like to call your Javascript and create a specific CSS class called <em>.ie_select</em> in your stylesheet and style it according to what you need it to do.  If you only want to apply the Javascript to specific browsers, you&#8217;ll need to add some conditional statements to your code.</p>
<h4>It&#8217;s fairly straight forward code.  This is what is going on: </h4>
<ol>
<li>When a select item has focus, add the CSS class of <em>.ie_select</em> to the select item. </li>
<li>When a select item loses focus or blurs, remove the CSS class of <em>.ie_select</em> from the select item.</li>
</ol>
<p>I&#8217;ve found this code is much more readable to someone like myself who dabbles in jQuery when it comes to presentational use of it.  That is exactly what the purpose of this code is, to fix presentation.</p>
<h4>FYI</h4>
<p>For what I was doing I had to add <em>position: absolute</em> to my CSS for <em>.ie_select</em> to get things to display the way I needed.  A majority of the tutorials out there did nothing more than change from a fixed width on the select to a <em>width: auto</em> and that seemed to be all they needed.  My layout was a bit more complicated and that didn&#8217;t work for me.  This code will not style your select element for you, but it will enable you to be able to style it the way you need things styled.</p>
]]></content:encoded>
			<wfw:commentRss>http://brandonbuttars.com/2009/09/css-select-options-internet-explorer-cut-off/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
