<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="http://feeds.feedburner.com/~d/styles/rss2full.xsl" type="text/xsl" media="screen"?><?xml-stylesheet href="http://feeds.feedburner.com/~d/styles/itemcontent.css" type="text/css" media="screen"?><rss 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:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>The Book and the Cover</title>
	
	<link>http://benjaminsterling.com</link>
	<description>Ok, you did not judge the book by it's cover, great.  Now, read the whole thing before passing judgment.</description>
	<pubDate>Thu, 20 Nov 2008 16:48:06 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5.1</generator>
	<language>en</language>
			<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" href="http://feeds.feedburner.com/benjaminsterling" type="application/rss+xml" /><item>
		<title>Slide in tab window using jQuery</title>
		<link>http://feeds.feedburner.com/~r/benjaminsterling/~3/459140908/</link>
		<comments>http://benjaminsterling.com/slide-in-tab-window-using-jquery/#comments</comments>
		<pubDate>Thu, 20 Nov 2008 04:03:16 +0000</pubDate>
		<dc:creator>Benjamin Sterling</dc:creator>
		
		<category><![CDATA[Tips]]></category>

		<category><![CDATA[Tutorials]]></category>

		<category><![CDATA[Web Development]]></category>

		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://benjaminsterling.com/?p=104</guid>
		<description><![CDATA[Say you want to wanted to put little tabs - you know, the ones like what you get from a lawyer or a realestate again to point out important things - off the side of your page so that your users can click, bring that tab into view to see what important information you want [...]]]></description>
			<content:encoded><![CDATA[<p>Say you want to wanted to put little tabs - you know, the ones like what you get from a lawyer or a realestate again to point out important things - off the side of your page so that your users can click, bring that tab into view to see what important information you want to point out.  Yeah, I know, you've seen these "tabs" a millions times and that is fine, but you have not seen it from my site and most likely you were not secretly brainwashed into learning about other jQuery methods that you don't already use or know about.</p>
<p>So, let the <span style="text-decoration: line-through;">brainwashing</span> education begin!</p>
<h3>The Tabs</h3>
<p><del datetime="2008-11-20T16:39:56+00:00">Take a look off to the left</del> I moved the <a href="http://www.benjaminsterling.com/wp-content/files/sidetab.htm" target="_blank">demo here</a>, do you see the three tabs that are there, they are so spectacularly named "tab 1", "tab2" and, yup you guessed it, "tab3."  The html structure is pretty straight forward:</p>
<div class="igBar"><span id="ljavascript-4"><a href="#" onclick="javascript:showPlainTxt('javascript-4'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">JavaScript:</span>
<div id="javascript-4">
<div class="javascript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;div id=<span style="color: #3366CC;">"sideTabs"</span>&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &lt;div <span style="color: #003366; font-weight: bold;">class</span>=<span style="color: #3366CC;">"tab"</span>&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &lt;h3&gt;Tab <span style="color: #CC0000;color:#800000;">1</span>&lt;/h3&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &lt;div <span style="color: #003366; font-weight: bold;">class</span>=<span style="color: #3366CC;">"gut"</span>&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;p&gt;Some text&lt;/p&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &lt;/div&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &lt;/div&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &lt;div <span style="color: #003366; font-weight: bold;">class</span>=<span style="color: #3366CC;">"tab"</span>&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &lt;h3&gt;Tab <span style="color: #CC0000;color:#800000;">2</span>&lt;/h3&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &lt;div <span style="color: #003366; font-weight: bold;">class</span>=<span style="color: #3366CC;">"gut"</span>&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;ul&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;li&gt;link&lt;/li&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;/ul&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &lt;/div&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &lt;/div&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &lt;div <span style="color: #003366; font-weight: bold;">class</span>=<span style="color: #3366CC;">"tab"</span>&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &lt;h3&gt;Tab <span style="color: #CC0000;color:#800000;">3</span>&lt;/h3&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &lt;div <span style="color: #003366; font-weight: bold;">class</span>=<span style="color: #3366CC;">"gut"</span>&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;ul&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;li&gt;link&lt;/li&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;/ul&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &lt;/div&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &lt;/div&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;/div&gt; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>You will notice that there are no links for the tabs and this is because we will create them on the fly.  Why?  Well, other then that I have a plan to show you some new tricks, imagine that you have JavaScript turned off, those will just be pointless links with a hash in them.  You can probably argue that we can put an ID with each tab and that link will be a link hash to that ID, and I will say that you are being <span style="text-decoration: line-through;">brainwashed</span> educated to my thinking.</p>
<h3>The CSS</h3>
<p>This part is actually completely open to you to format how ever you want, my initial thought was to do a bunch of "progressive enhancements" - don't you love buzzwords for not truly supporting older browsers - that would entail some gradients, rounded corners and dropshadows, but the point of this post was not to show off my CSS3 prowest.  The point was to show you some fancy methods so here is the CSS I am using:</p>
<div class="igBar"><span id="lcss-5"><a href="#" onclick="javascript:showPlainTxt('css-5'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CSS:</span>
<div id="css-5">
<div class="css">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">#sideTabs.closed<span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">left</span>:-310px;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">#sideTabs<span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">position</span>:<span style="color: #993333;">fixed</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">left</span>:<span style="color: #cc66cc;color:#800000;">0</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">top</span>:100px;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">width</span>:300px;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">height</span>:300px;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">border</span>: 10px <span style="color: #993333;">solid</span> #000000;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">background</span>:#fff;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">#sideTabs a.tabLinks<span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">position</span>:<span style="color: #993333;">absolute</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">right</span>:<span style="color: #cc66cc;color:#800000;">0</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">top</span>:<span style="color: #cc66cc;color:#800000;">0</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">outline</span>:<span style="color: #993333;">none</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">display</span>:<span style="color: #993333;">block</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">border</span>: 10px <span style="color: #993333;">solid</span> #000000;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; border-width<span style="color: #3333ff;">:1px </span>1px 1px 0px;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; -moz-border-radius: 0px 200px 200px 0px;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; -webkit-border-radius: <span style="color: #993333;">none</span> 200px 200px <span style="color: #993333;">none</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">margin</span>:<span style="color: #cc66cc;color:#800000;">0</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; padding<span style="color: #3333ff;">:<span style="color: #cc66cc;color:#800000;">0</span> </span>5px <span style="color: #cc66cc;color:#800000;">0</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">color</span>:#000;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">text-decoration</span>:<span style="color: #993333;">none</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">font</span>:12px/25px Verdana, Arial, Helvetica, <span style="color: #993333;">sans-serif</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">background</span>:#000;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">color</span>:#fff;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">z-index</span>:<span style="color: #cc66cc;color:#800000;">20</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">#sideTabs a.tabLinks.active<span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; font<span style="color: #3333ff;">:<span style="color: #993333;">bold</span> </span>14px/25px Verdana, Arial, Helvetica, <span style="color: #993333;">sans-serif</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">background</span>:#fff;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">color</span>:#000;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">z-index</span>:<span style="color: #cc66cc;color:#800000;">21</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<h3>The jQuery</h3>
<p>Alright, we are at the meat and potatoes the corn and the cob the Larry and Moe (and Curly)... sadly that is the best I can do with those analogies.  Any who, we are at the JavaScript, what I will do is post the code and the try to explain what is happening line by line:</p>
<div class="igBar"><span id="ljavascript-6"><a href="#" onclick="javascript:showPlainTxt('javascript-6'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">JavaScript:</span>
<div id="javascript-6">
<div class="javascript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #003366; font-weight: bold;">var</span> jqsideTabs;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #003366; font-weight: bold;">var</span> tabs, h = <span style="color: #CC0000;color:#800000;">50</span>, r = <span style="color: #CC0000;color:#800000;">0</span>,ra = <span style="color: #CC0000;color:#800000;">0</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">$<span style="color: #66cc66;">&#40;</span>document<span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">.<span style="color: #006600;">ready</span><span style="color: #66cc66;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; jqsideTabs = $<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'#sideTabs'</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">addClass</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'closed'</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; tabs = jqsideTabs</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; .<span style="color: #006600;">find</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'.tab h3'</span><span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; .<span style="color: #006600;">clone</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; .<span style="color: #006600;">appendTo</span><span style="color: #66cc66;">&#40;</span>jqsideTabs<span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; .<span style="color: #006600;">each</span><span style="color: #66cc66;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span>i<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">var</span> that = $<span style="color: #66cc66;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #66cc66;">&#41;</span>, cls = <span style="color: #3366CC;">''</span>,ow,newThis, newEl;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">if</span><span style="color: #66cc66;">&#40;</span> i == <span style="color: #CC0000;color:#800000;">0</span> <span style="color: #66cc66;">&#41;</span> cls = <span style="color: #3366CC;">' active'</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; newEl = $<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'&lt;a href=&quot;#&quot; class=&quot;tabLinks'</span>+cls+<span style="color: #3366CC;">'&quot;&gt;'</span> + that.<span style="color: #006600;">text</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> + <span style="color: #3366CC;">'&lt;/a&gt;'</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; that.<span style="color: #006600;">replaceWith</span><span style="color: #66cc66;">&#40;</span>newEl<span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; ow = newEl.<span style="color: #006600;">outerWidth</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">if</span><span style="color: #66cc66;">&#40;</span> i == <span style="color: #CC0000;color:#800000;">0</span> <span style="color: #66cc66;">&#41;</span> ra = ow;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">else</span> r = ow;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; h = newEl.<span style="color: #006600;">css</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#123;</span><span style="color: #3366CC;">'top'</span>:h , <span style="color: #3366CC;">'right'</span>: -ow <span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">height</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> + h;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; newThis = newEl.<span style="color: #006600;">get</span><span style="color: #66cc66;">&#40;</span><span style="color: #CC0000;color:#800000;">0</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; newThis.<span style="color: #006600;">jq</span> = newEl;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; newThis.<span style="color: #006600;">i</span> = i;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; newEl.<span style="color: #006600;">click</span><span style="color: #66cc66;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">var</span> el = <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #006600;">jq</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">if</span><span style="color: #66cc66;">&#40;</span> jqsideTabs.<span style="color: #006600;">hasClass</span><span style="color: #66cc66;">&#40;</span> <span style="color: #3366CC;">'closed'</span> <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; jqsideTabs.<span style="color: #006600;">removeClass</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'closed'</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">else</span> <span style="color: #000066; font-weight: bold;">if</span><span style="color: #66cc66;">&#40;</span> !jqsideTabs.<span style="color: #006600;">hasClass</span><span style="color: #66cc66;">&#40;</span> <span style="color: #3366CC;">'closed'</span> <span style="color: #66cc66;">&#41;</span> &amp;&amp; el.<span style="color: #006600;">hasClass</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'active'</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; jqsideTabs.<span style="color: #006600;">addClass</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'closed'</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; el</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .<span style="color: #006600;">siblings</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .<span style="color: #006600;">removeClass</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'active'</span><span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .<span style="color: #006600;">css</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#123;</span><span style="color: #3366CC;">'right'</span>: -r <span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .<span style="color: #006600;">end</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .<span style="color: #006600;">addClass</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'active'</span><span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .<span style="color: #006600;">css</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#123;</span><span style="color: #3366CC;">'right'</span>: -ra <span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; tabs.<span style="color: #006600;">eq</span><span style="color: #66cc66;">&#40;</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #006600;">i</span> <span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">show</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">siblings</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'.tab'</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">hide</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #003366; font-weight: bold;">false</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; .<span style="color: #006600;">end</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; .<span style="color: #006600;">parent</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; .<span style="color: #006600;">eq</span><span style="color: #66cc66;">&#40;</span><span style="color: #CC0000;color:#800000;">0</span><span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; .<span style="color: #006600;">addClass</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'active'</span><span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; .<span style="color: #006600;">end</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; .<span style="color: #006600;">filter</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">':not(:eq(0))'</span><span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; .<span style="color: #006600;">hide</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; .<span style="color: #006600;">end</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; jqsideTabs.<span style="color: #006600;">bind</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">"mouseleave"</span>,<span style="color: #003366; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; jqsideTabs</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; .<span style="color: #006600;">animate</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#123;</span>left:-<span style="color: #CC0000;color:#800000;">310</span><span style="color: #66cc66;">&#125;</span>, <span style="color: #3366CC;">'fast'</span>, <span style="color: #003366; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; jqsideTabs.<span style="color: #006600;">addClass</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'closed'</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">removeAttr</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'style'</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p>
<strong>Update:</strong> <a href="http://www.benjaminsterling.com/wp-content/files/sidetab.htm" target="_blank">Moved the demo to a separate page.</a></p>
<h3>The Explanation</h3>
<p>Lines 1 and 2 are just some variables that I will be setting and reusing through-out the code.</p>
<p>Line 5 I set the "jqsideTabs" variable to reference the jQuery object for the element with an ID of sideTabs and I also add a class of "close".</p>
<p>Line 7 a reference is being set and I will point a little later below what that is actually being referenced too.</p>
<p>Line 8 we look inside the jqsideTabs DIV for the H3 elements that are inside the ".tab" DIVs.  I can just as easily do jqsideTabs.find('.tab &gt; h3') to make sure to the H3 tag directly below the ".tab" element or jqsideTabs.find('.tab h3<a href="http://docs.jquery.com/Selectors/firstChild" target="_blank">:first-child</a>') to make sure I grabbing the first H3 that is the first element under '.tab'.</p>
<p>Line 9 we <a href="http://docs.jquery.com/Manipulation/clone" target="_blank">clone()</a> those H3 elements, if we do <a href="http://docs.jquery.com/Manipulation/clone#true" target="_blank">.clone(true)</a> we will also clone any events that are bound to the H3.</p>
<p>Line 10 we append the cloned H3s to "jqsideTabs"</p>
<p>Line 11 through to 51 we are looping through those H3s to do some fanciness.  Notice the "i" in the function?  That will be returning the index of the loop starting at zero (0).</p>
<p>Line 12 some variables are set up.</p>
<p>Line 14 we check if we are on the first index, which is zero (0), and then set the "cls" variable to "active".</p>
<p>Line 15 we set up a reference to a new DOM element/jQuery object that has the text of the H3 element by using "that<a href="http://docs.jquery.com/Attributes/text" target="_blank">.text()</a>".</p>
<p>Line 16 we replace the H3 with the newly create DOM element, the A element/tag/</p>
<p>Line 18 we get the outer width (<a href="http://docs.jquery.com/CSS/outerWidth#options" target="_blank">.outerWidth()</a>) of the element, outerWidth() will get the full width of the element including border and padding, if you were to do outerWidth(true) you would also get the margins.</p>
<p>Line 20 we check if it is the first index again and if so, set the variable "ra" to the outer width</p>
<p>Line 21 is the else part of line 20 and here we set the "r" variable.  Both "ra" and "r" will be used for "right active" and "right".  You will see their purpose shortly.</p>
<p>Line 23 is doing a few things, 1) it is setting the top and right positions of the element and returning the <a href="http://docs.jquery.com/CSS/height" target="_blank">.height()</a> of the element plus the previously stored height at the same time.</p>
<p>Line 25 we are using the <a href="http://docs.jquery.com/Core/get#index" target="_blank">.get(0)</a> method against the newly created A tag and this will give us the equivalent of doing a getElementById.</p>
<p>Line 26 we set the reference now so that we don't have to re-look up this element later on, the speed gain is probably minimum at best but I makes me happy to do this and really, that is what it's all about.</p>
<p>Line 27 and line 26 we are doing something specific and really can't remember what it is called, maybe "assignment," but basically we are storing some data directly in the DOM to be used later.</p>
<p>Line 29 we add a <a href="http://docs.jquery.com/Events/click#fn" target="_blank">.click()</a> event to the A tag we created.</p>
<p>Line 30 just to stick to a decent naming conventions I take the varariable I set earlier and plop it into a new variable call "el" (short for element)</p>
<p>Line 32 to 34 we check to see if the jqsideTabs element has a class (<a href="http://docs.jquery.com/Traversing/hasClass#class" target="_blank">.hasClass()</a>) of "closed", if so, remove that class.</p>
<p>Line 35 to 37 we check to see if the jqsidetabs element <strong>does not have</strong> a class of "closed" and the current element has a class of "active", if so, add the class "close".</p>
<p>Line 40 we grab all the <a href="http://docs.jquery.com/Traversing/siblings#expr" target="_blank">.siblings()</a>, in this case, all the .tab DIVs and links that were created.</p>
<p>Line 41 each item returns will have the class "active" removed.</p>
<p>Line 42 the default right position is set for those elements.  But let me note something real quick, in this case I am going with the assumption that I did not set the "position" of the .tab elements to anything, meaning, they were not set to relative or absolute.  If I did this I would need to change siblings to only grab items at are A tags to be sure I only grab the, well, A tags.</p>
<p>Line 43 the <a href="http://docs.jquery.com/Traversing/end" target="_blank">.end()</a> method is used, this brings the reference back to "el" at line 39.</p>
<p>Line 44 a class of "active" is added.</p>
<p>Line 45 the right position is set to the "ra" variable.</p>
<p>Line 47 with the reference of tabs that was set back at line 7, we find the DIV or .tab that equals what ever that index (i) is match to, in the example it can be either 0, 1 or 2, then we show that one and then hide its siblings that have a class of ".tab".</p>
<p>Line 49 a return of false is used to stop the default action of the link.</p>
<p>Line 52 end() is used to give reference back to the H3 tags.</p>
<p>Line 53 we use <a href="http://docs.jquery.com/Traversing/parent#expr" target="_blank">.parent()</a> to grab the parents of the H3 tags.</p>
<p>Line 54 we filter down to the first element in the parents by using .eq(0).</p>
<p>Line 55 a class is added to that returned element from line 54.</p>
<p>Line 56 we go back to all the parents by using .end()</p>
<p>Line 57 filter is used with the combination seletor of "<a href="http://docs.jquery.com/Selectors/not#selector" target="_blank">:not()</a>" and ":eq(0)" to grab all the DIVs (the parents of the H3s) that is not equal to the first one.</p>
<p>Line 58 then we hide the returned elements</p>
<p>Line 59 here we use end() to finally set the "tabs" variable that we have way back at line 7.</p>
<h3>The Closing</h3>
<p>Ok, are you <span style="text-decoration: line-through;">brainwashed</span> educated yet?  Could I have combined a few steps or could I have writen some of my selectors to be a little more precise? Sure I could have.  The beauty of coding with jQuery is that there can be any number of ways to approach the same exact issue.  But do keep in mind that my way is always the right way.</p>
<p>But seriously, there are a lot of ways to use the jQuery framework, you have to find the way the best suits you.  And the only way to find that out is to learn how others do it and read the docs and learn the <a href="http://docs.jquery.com/Selectors" target="_blank">selectors</a> and <a href="http://docs.jquery.com/Traversing" target="_blank">traversing</a> methods.</p>
<p>As always, please feel free to check me if I got something incorrect or if you think you can do better.  I am just as open to learning as you should be.</p>

<p><a href="http://feeds.feedburner.com/~a/benjaminsterling?a=QXg6bK"><img src="http://feeds.feedburner.com/~a/benjaminsterling?i=QXg6bK" border="0"></img></a></p>]]></content:encoded>
			<wfw:commentRss>http://benjaminsterling.com/slide-in-tab-window-using-jquery/feed/</wfw:commentRss>
		<feedburner:origLink>http://benjaminsterling.com/slide-in-tab-window-using-jquery/</feedburner:origLink></item>
		<item>
		<title>Web Tech November Meetup</title>
		<link>http://feeds.feedburner.com/~r/benjaminsterling/~3/458496451/</link>
		<comments>http://benjaminsterling.com/web-tech-november-meetup/#comments</comments>
		<pubDate>Wed, 19 Nov 2008 15:27:16 +0000</pubDate>
		<dc:creator>Benjamin Sterling</dc:creator>
		
		<category><![CDATA[Presentations]]></category>

		<category><![CDATA[Ramblings]]></category>

		<category><![CDATA[Tips]]></category>

		<guid isPermaLink="false">http://benjaminsterling.com/?p=103</guid>
		<description><![CDATA[Well ladies and Gents, looks like I will be doing another jQuery presentation at the Web Tech November Meetup at the "Investors United Baltimore Campus" on the 24th of November.
The presentation will break from the normal jQuery presentations you see on the web and will be approached in the way I explain jQuery to co-workers, [...]]]></description>
			<content:encoded><![CDATA[<p>Well ladies and Gents, looks like I will be doing another jQuery presentation at the Web Tech November Meetup at the "<a href="http://maps.google.com/maps?q=6721+Harford+Rd.+Baltimore,+MD+21234&amp;ie=UTF8&amp;oe=utf-8&amp;client=firefox-a&amp;ll=39.370801,-76.528702&amp;spn=0.118637,0.264359&amp;z=13&amp;iwloc=addr">Investors United Baltimore Campus</a>" on the 24th of November.</p>
<p>The presentation will break from the normal jQuery presentations you see on the web and will be approached in the way I explain jQuery to co-workers, people through my site, or Tweeter.  I will point you to the resources you need to know about and get familiar with, which all presentations do.  But I will not be giving you the history of jQuery, I don't believe people come to these presentations or meetups to learn the history of something, they want to know how it works.  And that is what I will tell you, how jQuery works with in the context of your everyday projects.  I will give you some tips on how to structure your code, what selectors are faster and how to use some of those <a href="http://docs.jquery.com/Traversing">fancy traversing methods</a>.</p>
<p>I have not decide exactly which methods to focus on, I am still research which ones I really use most often and which ones other developers use most often.  But be sure that the ones I pick will be ones that you will start using immediately.</p>
<p>So come on out and see me ramble on on how good jQuery is or just come out to see how sexy i really am, it will be a good time either way.</p>
<p><a href="http://www.meetup.com/webdevelopment/calendar/9134655/">Be sure to RSVP!</a></p>

<p><a href="http://feeds.feedburner.com/~a/benjaminsterling?a=pLNRwv"><img src="http://feeds.feedburner.com/~a/benjaminsterling?i=pLNRwv" border="0"></img></a></p>]]></content:encoded>
			<wfw:commentRss>http://benjaminsterling.com/web-tech-november-meetup/feed/</wfw:commentRss>
		<feedburner:origLink>http://benjaminsterling.com/web-tech-november-meetup/</feedburner:origLink></item>
		<item>
		<title>Turn that frown right side up</title>
		<link>http://feeds.feedburner.com/~r/benjaminsterling/~3/456623569/</link>
		<comments>http://benjaminsterling.com/turn-that-frown-right-side-up/#comments</comments>
		<pubDate>Tue, 18 Nov 2008 01:25:13 +0000</pubDate>
		<dc:creator>Benjamin Sterling</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://benjaminsterling.com/?p=102</guid>
		<description><![CDATA[Ok, this is going to be a real quick post, Toby Pitman did a guest post over at CSS-Tricks and it got me thinking what other simple things can be done with the css property "-webkit-transform."  The best I could come up with was to flip those emotional icons upright.
Note: this will only work in [...]]]></description>
			<content:encoded><![CDATA[<p>Ok, this is going to be a real quick post, Toby Pitman did a guest post over at <a href="http://css-tricks.com/css3-clock/">CSS-Tricks</a> and it got me thinking what other simple things can be done with the css property "-webkit-transform."  The best I could come up with was to flip those emotional icons upright.</p>
<p><strong>Note:</strong> this will only work in WebKit browsers as of this writing so don't tell me it does not work in IE7 or below or in Firefox 3 or below, I know, it is meant to be a test for WebKit.</p>
<p>So, lets assume you have the following conversation:</p>
<blockquote><p>You are so cute :)</p>
<p>No, you are ;)</p>
<p>But I said it first &gt;:(</p>
<p>Why are you getting mad :O</p>
<p>I don't know :S</p>
<p>:/</p></blockquote>
<p>Great convo right? Not let's put some JavaScript into the mix here:</p>
<div class="igBar"><span id="ljavascript-9"><a href="#" onclick="javascript:showPlainTxt('javascript-9'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">JavaScript:</span>
<div id="javascript-9">
<div class="javascript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">$<span style="color: #66cc66;">&#40;</span>document<span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">.<span style="color: #006600;">ready</span><span style="color: #66cc66;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; $<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'p'</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">each</span><span style="color: #66cc66;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">var</span> jqthis = $<span style="color: #66cc66;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">var</span> txt = jqthis.<span style="color: #006600;">html</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">replace</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066FF;">/\B<span style="color: #66cc66;">&#40;</span>:\<span style="color: #66cc66;">&#41;</span>|;\<span style="color: #66cc66;">&#41;</span>|&gt;:\<span style="color: #66cc66;">&#40;</span>|:O|:S|:\/<span style="color: #66cc66;">&#41;</span>/g</span>, <span style="color: #3366CC;">'&lt;span class=&quot;icon&quot;&gt;$1&lt;/span&gt;'</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; jqthis.<span style="color: #006600;">html</span><span style="color: #66cc66;">&#40;</span> txt <span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Basically what that is saying is grab all the paragraphs, grab the HTML out of them.  Use some RegEx to search through the characters to find the emotional icons, and then replace them with a SPAN and the characters that are being replaced (that would be the $1).</p>
<p>Now lets add some style to the mix:</p>
<div class="igBar"><span id="lcss-10"><a href="#" onclick="javascript:showPlainTxt('css-10'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CSS:</span>
<div id="css-10">
<div class="css">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;style&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">.<span style="color: #993333;">icon</span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;-webkit-transform: rotate<span style="color: #66cc66;">&#40;</span>90deg<span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color: #000000; font-weight: bold;">color</span>:#ff0000;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color: #000000; font-weight: bold;">display</span>:inline-<span style="color: #993333;">block</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;padding<span style="color: #3333ff;">:<span style="color: #cc66cc;color:#800000;">0</span> </span>2px;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;/style&gt; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>And this is what we get:</p>
<style>
.icon{
   -webkit-transform: rotate(90deg);
   color:#ff0000;
   display:inline-block;
   padding:0 2px;
}
</style>
<p><script type="text/javascript"><!--
$(document)
.ready(function(){
	$('.doIcon').each(function(){
		var jqthis = $(this);
		var txt = jqthis.html().replace(/\B(:\)|;\)|>:\(|:O|:S|:\/)/g, '<span class="icon">$1</span>');
		jqthis.html( txt );
	});
});
// --></script></p>
<blockquote>
<p class="doIcon">You are so cute :)</p>
<p class="doIcon">No, you are ;)</p>
<p class="doIcon">But I said it first &gt;:(</p>
<p class="doIcon">Why are you getting mad :O</p>
<p class="doIcon">I don't know :S</p>
<p class="doIcon">:/</p>
</blockquote>
<p>Neat trick, nothing real special, but the possibilities are really beginning to open up.</p>

<p><a href="http://feeds.feedburner.com/~a/benjaminsterling?a=SzdtlM"><img src="http://feeds.feedburner.com/~a/benjaminsterling?i=SzdtlM" border="0"></img></a></p>]]></content:encoded>
			<wfw:commentRss>http://benjaminsterling.com/turn-that-frown-right-side-up/feed/</wfw:commentRss>
		<feedburner:origLink>http://benjaminsterling.com/turn-that-frown-right-side-up/</feedburner:origLink></item>
		<item>
		<title>Better jQuery Code #2</title>
		<link>http://feeds.feedburner.com/~r/benjaminsterling/~3/455015454/</link>
		<comments>http://benjaminsterling.com/better-jquery-code-2/#comments</comments>
		<pubDate>Sun, 16 Nov 2008 16:00:17 +0000</pubDate>
		<dc:creator>Benjamin Sterling</dc:creator>
		
		<category><![CDATA[Tips]]></category>

		<category><![CDATA[Web Development]]></category>

		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://benjaminsterling.com/?p=101</guid>
		<description><![CDATA[In a follow up to my Better jQuery Code #1 post I will be writing about some other small items that I have found to make my code better and more readable.
Chaining
Chaining is one of the most beautiful and time save pieces of code structure that jQuery brought to the game, the problem is is [...]]]></description>
			<content:encoded><![CDATA[<p>In a follow up to my <a href="http://benjaminsterling.com/better-jquery-code-1/">Better jQuery Code #1</a> post I will be writing about some other small items that I have found to make my code better and more readable.</p>
<h3>Chaining</h3>
<p>Chaining is one of the most beautiful and time save pieces of code structure that jQuery brought to the game, the problem is is that it can make the code unreadable if not treated correctly.</p>
<p>For example, say you wanted to select the fourth LI in your nav and add a class, remove a class from it, then you want to find the UL that is a child of that LI and add a class to that, then want to move back to the UL that has the ID nav on it (.end() goes back to the last 'destructive' operation) and lastly you want to animate that UL.  Along with have a heft run on sentence you also have a pretty unreadable string of functions.</p>
<div class="igBar"><span id="ljavascript-21"><a href="#" onclick="javascript:showPlainTxt('javascript-21'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">JavaScript:</span>
<div id="javascript-21">
<div class="javascript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">$<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'#nav'</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">find</span><span style="color: #66cc66;">&#40;</span>&amp;gt; li<span style="color: #3366CC;">').eq(3).addClass('</span>className<span style="color: #3366CC;">').removeClass('</span>otherClass<span style="color: #3366CC;">').find('</span>ul<span style="color: #3366CC;">').addClass('</span>redClass<span style="color: #3366CC;">').end().end().end().slideUp().slideDown(); </span></div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Instead, format you code to look something like below, you can have more then one methods per line, but keep it reasonable and readable.  See how I am indenting each line?  This is to give it a sense that each method is referring to specific elements.  Much like you would indent your HTML and how some people indent their related CSS, it is good practice to indent your code.</p>
<div class="igBar"><span id="ljavascript-22"><a href="#" onclick="javascript:showPlainTxt('javascript-22'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">JavaScript:</span>
<div id="javascript-22">
<div class="javascript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">$<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'#nav'</span><span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; .<span style="color: #006600;">find</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'&gt; li'</span><span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; .<span style="color: #006600;">eq</span><span style="color: #66cc66;">&#40;</span><span style="color: #CC0000;color:#800000;">3</span><span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; .<span style="color: #006600;">addClass</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'className'</span><span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; .<span style="color: #006600;">removeClass</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'otherClass'</span><span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; .<span style="color: #006600;">find</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'ul'</span><span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .<span style="color: #006600;">addClass</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'redClass'</span><span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; .<span style="color: #006600;">end</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; .<span style="color: #006600;">end</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">.<span style="color: #006600;">end</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">.<span style="color: #006600;">slideUp</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">.<span style="color: #006600;">slideDown</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>A small caveat to the above structure is that if you run your code through <a href="http://www.javascriptlint.com/online_lint.php">JavaScript Lint</a> you will get a notice of "lint warning: unexpected end of line; it is ambiguous whether these lines are part of the same statement," I personally don't see an issue with this and will just to a find and replace for the line break and all is good.</p>
<h3>Traversing (Finding)</h3>
<p><a href="http://benjaminsterling.com/better-jquery-code-1/"><br />
Last post I posted about <strong>eq, hasClass, is, and not</strong></a> which are four traversing methods for filtering out certain items from your select.  For returning specific elements from the DOM using the <a href="http://docs.jquery.com/Traversing/children#expr" target="_blank">children()</a>, <a href="http://docs.jquery.com/Traversing/siblings" target="_blank">siblings()</a>, <a href="http://docs.jquery.com/Traversing/parent#expr" target="_blank">parent()</a>, and <a href="http://docs.jquery.com/Traversing/parents#expr" target="_blank">parents()</a> methods in most of my projects.</p>
<blockquote class="quote"><p>The Core developers for jQuery are very smart people</p></blockquote>
<p>The Core developers for jQuery are very smart people, they name methods the make a lot of sense and match up to the functionality they provide and <strong>children()</strong> is not an exception.  Let's assume we have the following DOM structure:</p>
<div class="igBar"><span id="ljavascript-23"><a href="#" onclick="javascript:showPlainTxt('javascript-23'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">JavaScript:</span>
<div id="javascript-23">
<div class="javascript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;ul id=<span style="color: #3366CC;">"nav"</span>&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &lt;li&gt;&lt;a&gt;Text&lt;<span style="color: #0066FF;">/a&gt;&lt;/</span>li&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &lt;li&gt;&lt;a&gt;Text&lt;<span style="color: #0066FF;">/a&gt;&lt;/</span>li&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &lt;li&gt;&lt;a&gt;Text&lt;<span style="color: #0066FF;">/a&gt;&lt;/</span>li&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &lt;li&gt;&lt;a&gt;Text&lt;<span style="color: #0066FF;">/a&gt;&lt;/</span>li&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &lt;li&gt; &lt;a&gt;Text&lt;/a&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;ul&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &lt;li&gt;&lt;a&gt;text&lt;<span style="color: #0066FF;">/a&gt;&lt;/</span>li&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;/ul&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;/li&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &lt;li&gt;&lt;a&gt;Text&lt;<span style="color: #0066FF;">/a&gt;&lt;/</span>li&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &lt;li&gt;&lt;a&gt;Text&lt;<span style="color: #0066FF;">/a&gt;&lt;/</span>li&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;/ul&gt; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>With that structure, we did:</p>
<div class="igBar"><span id="ljavascript-24"><a href="#" onclick="javascript:showPlainTxt('javascript-24'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">JavaScript:</span>
<div id="javascript-24">
<div class="javascript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">$<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'#nav'</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">children</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>How many elements would be returned? 17? 15? 7?</p>
<p>If you said 7 then you are correct; why not 17 or 15?  Imagine this, you have a single parent, and you have 6 brothers each of whom have a significant other.  You and your significant other have a daughter and she in turns has a kid but is single and that kid has a childhood sweetheart.  In this scenario "#nav" is your mother (we'll cover the parent and parents method below but keep this in your head) and when we say give me all your children we are only look for your mothers immediate children, which in this case are the LI.</p>
<p>Got that?</p>
<p>Ok, now what do you get if you do the following with the <strong>siblings()</strong> method?</p>
<div class="igBar"><span id="ljavascript-25"><a href="#" onclick="javascript:showPlainTxt('javascript-25'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">JavaScript:</span>
<div id="javascript-25">
<div class="javascript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">$<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'li:eq(4)'</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">siblings</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>If you said 6, you are correct, siblings will select all your immediate brothers and sisters.  You following me so far?  Does this make sense?  In this example we are saying select the LI that is in the forth index (or in this case, you) and then get my brothers and sisters or siblings.</p>
<p>Just for a teaser, what if you wanted to something to you and your siblings?  Easy, just add<strong> .andSelf()</strong> at the end (this would probably be used in a case where you click on a LI and do $(this)).  We'll cover this a bit more in a later post.</p>
<div class="igBar"><span id="ljavascript-26"><a href="#" onclick="javascript:showPlainTxt('javascript-26'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">JavaScript:</span>
<div id="javascript-26">
<div class="javascript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">$<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'li:eq(4)'</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">siblings</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">andSelf</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>The <strong>.parent()</strong> method is pretty straight forward, it will select your immediate parent.  So in the following case you will select the UL.</p>
<div class="igBar"><span id="ljavascript-27"><a href="#" onclick="javascript:showPlainTxt('javascript-27'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">JavaScript:</span>
<div id="javascript-27">
<div class="javascript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">$<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'li:eq(4)'</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">parent</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>The <strong>parent() </strong>method excepts an expression but the only need I've ever had was to quickly test the parent for something particular, maybe a class or a specific attribute or attribute with a certain value, in an IF statement. (remember, in JavaScript 0 is treated at false and 1 is treated as true)</p>
<div class="igBar"><span id="ljavascript-28"><a href="#" onclick="javascript:showPlainTxt('javascript-28'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">JavaScript:</span>
<div id="javascript-28">
<div class="javascript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000066; font-weight: bold;">if</span><span style="color: #66cc66;">&#40;</span> $<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'li:eq(4)'</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">parent</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'.selected'</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000066; font-weight: bold;">if</span><span style="color: #66cc66;">&#40;</span> $<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'li:eq(4)'</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">parent</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'[data]'</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000066; font-weight: bold;">if</span><span style="color: #66cc66;">&#40;</span> $<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'li:eq(4)'</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">parent</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'[start=5]'</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>The <strong>parents()</strong> method can be a little more powerful for your needs, but is useful in some cases.  Let's assume that the UL above is the only code in your body tag.  So if you do the following how many items will be returned? 1? 2? 3? 4?</p>
<div class="igBar"><span id="ljavascript-29"><a href="#" onclick="javascript:showPlainTxt('javascript-29'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">JavaScript:</span>
<div id="javascript-29">
<div class="javascript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">$<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'li:eq(4)'</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">parents</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>If you said anything but 3 you would be incorrect, if the UL code above was the only child of the body tag that the JavaScript code above would return the UL, BODY, and HTML tags.  With the parents method you can filter it down to what you want by using any number of selectors that jQuery supports.</p>
<p>Below is a piece of code from a project I've been working on.  Basically the issue was that there needed to be a submit button appended after the last input box on the page. If that input box is inside of table, append the button after the table.  The issue was, I had not idea what the TABLE may be in, could have been a DIV that is inside of a DIV and so on.  Also keep in mind that as of this writing I see at least one better way to have written out this code but for this post this example should work fine.</p>
<div class="igBar"><span id="ljavascript-30"><a href="#" onclick="javascript:showPlainTxt('javascript-30'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">JavaScript:</span>
<div id="javascript-30">
<div class="javascript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900; font-style: italic;">// inlineTextQuestion is a reference to all the input elements</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #003366; font-weight: bold;">var</span> lastOne = inlineTextQuestion.<span style="color: #006600;">eq</span><span style="color: #66cc66;">&#40;</span> inlineTextQuestion.<span style="color: #006600;">size</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>-<span style="color: #CC0000;color:#800000;">1</span> <span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #003366; font-weight: bold;">var</span> lastOneParents = lastOne.<span style="color: #006600;">parents</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #003366; font-weight: bold;">var</span> lastOneParent = <span style="color: #003366; font-weight: bold;">null</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">lastOneParents</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">.<span style="color: #006600;">each</span><span style="color: #66cc66;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span>i<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">if</span><span style="color: #66cc66;">&#40;</span> lastOneParent === <span style="color: #003366; font-weight: bold;">null</span> <span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">var</span> el = $<span style="color: #66cc66;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900; font-style: italic;">// #bodyText is the one known factor I had</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">if</span><span style="color: #66cc66;">&#40;</span> el.<span style="color: #006600;">parent</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #000066; font-weight: bold;">is</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'#bodyText'</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; lastOneParent = el;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900; font-style: italic;">// sbmt is a reference to a submit button create about this code</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">lastOneParent.<span style="color: #006600;">after</span><span style="color: #66cc66;">&#40;</span>sbmt<span style="color: #66cc66;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Let me try to explain what is going on, please refer to the comments in the code for what the variables are reference to, line 2 I am grabbing a reference to the last INPUT in the inlineTextQuestion variable.  Line 3 I grabbed a reference to the all the parents of that INPUT.  Line 6/7 I loop through all the parents checking , at line 11, to see if the current element's parent is the DIV with the ID of "bodyText."  If that returns true we set a reference to that element and at line 18 I append the submit button after that referenced element.</p>
<h3>Closing</h3>
<p>In this post we discussed using the <a href="http://docs.jquery.com/Traversing/children#expr" target="_blank">children()</a>, <a href="http://docs.jquery.com/Traversing/siblings" target="_blank">siblings()</a>, <a href="http://docs.jquery.com/Traversing/parent#expr" target="_blank">parent()</a>, and <a href="http://docs.jquery.com/Traversing/parents#expr" target="_blank">parents()</a> methods and I try to explain them the way I see them.  These are the ones I use the most and the ones I think you will find the love for.</p>
<p>If there is anything with the above you don't under stand or, god forbid, I got incorrect, please feel free to drop me a line.</p>

<p><a href="http://feeds.feedburner.com/~a/benjaminsterling?a=oMi6Jf"><img src="http://feeds.feedburner.com/~a/benjaminsterling?i=oMi6Jf" border="0"></img></a></p>]]></content:encoded>
			<wfw:commentRss>http://benjaminsterling.com/better-jquery-code-2/feed/</wfw:commentRss>
		<feedburner:origLink>http://benjaminsterling.com/better-jquery-code-2/</feedburner:origLink></item>
		<item>
		<title>Better jQuery Code #1</title>
		<link>http://feeds.feedburner.com/~r/benjaminsterling/~3/454174374/</link>
		<comments>http://benjaminsterling.com/better-jquery-code-1/#comments</comments>
		<pubDate>Sat, 15 Nov 2008 18:01:50 +0000</pubDate>
		<dc:creator>Benjamin Sterling</dc:creator>
		
		<category><![CDATA[Tips]]></category>

		<category><![CDATA[Web Development]]></category>

		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://benjaminsterling.com/?p=99</guid>
		<description><![CDATA[
I've been wanting to write some jQuery tips for a while now and just never know what to really say until I saw Marc Grabanski's 5 Tips for Better jQuery Code.  Although I have tips, I don't think I have any that are Earth shattering or ones that I can rank higher then the other, [...]]]></description>
			<content:encoded><![CDATA[<div class="featureImg"><img class="alignnone size-full wp-image-100" title="jquery_logo_color_onwhite" src="http://benjaminsterling.com/wp-content/uploads/2008/11/jquery_logo_color_onwhite.png" alt="" width="610" /></div>
<p><br/></p>
<p>I've been wanting to write some jQuery tips for a while now and just never know what to really say until I saw <a title="5 Tips for Better jQuery Code" href="http://marcgrabanski.com/article/5-tips-for-better-jquery-code" target="_blank">Marc Grabanski's 5 Tips for Better jQuery Code</a>.  Although I have tips, I don't think I have any that are Earth shattering or ones that I can rank higher then the other, but these are ones that I use daily and are asked about just as often.</p>
<h3>Caching</h3>
<p>If there are items you will be referencing more than once, cache it!  Even if you won't be referencing an item more than once still get in the habit of setting up references.</p>
<p>Now, what do I mean references?  If you are going to be playing with you main nav group or probably going to be messing with inputs, set up a variable and store the reference to those element in it.</p>
<div class="igBar"><span id="ljavascript-39"><a href="#" onclick="javascript:showPlainTxt('javascript-39'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">JavaScript:</span>
<div id="javascript-39">
<div class="javascript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #003366; font-weight: bold;">var</span> mainNav = $<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'#main_nav a'</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #003366; font-weight: bold;">var</span> inputs = $<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'input'</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900; font-style: italic;">// the make calls like</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">mainNav.<span style="color: #006600;">click</span><span style="color: #66cc66;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span><span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">input.<span style="color: #006600;">change</span><span style="color: #66cc66;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span><span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>[Update #1: as <a href="http://benjaminsterling.com/better-jquery-code-1/#comment-5149">Sean O</a> points out, doing $mainNav may help you remember that the variable is a jQuery object and may be good practice.]</p>
<p>[Update #2: Another good point from <a href="http://benjaminsterling.com/better-jquery-code-1/#comment-5151">Dan G. Switzer</a>, you could easily have cached your jQuery objects when you initiated your events/behaviors like below]</p>
<div class="igBar"><span id="ljavascript-40"><a href="#" onclick="javascript:showPlainTxt('javascript-40'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">JavaScript:</span>
<div id="javascript-40">
<div class="javascript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #003366; font-weight: bold;">var</span> $mainNav = $<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'#mainNav'</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">click</span><span style="color: #66cc66;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span><span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<h3>Traversing (Filtering)</h3>
<p>This is a topic I plan to put some more effort into in a later post but there are four methods you should use: <strong><a href="http://docs.jquery.com/Traversing/eq#index" target="_blank">eq</a>, <a href="http://docs.jquery.com/Traversing/hasClass#class" target="_blank">hasClass</a>, <a href="http://docs.jquery.com/Traversing/is#expr" target="_blank">is</a>, and <a href="http://docs.jquery.com/Traversing/not#expr" target="_blank">not</a></strong>.</p>
<p>The use of these methods will filter out your selection to mat</p>
<div class="igBar"><span id="ljavascript-41"><a href="#" onclick="javascript:showPlainTxt('javascript-41'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">JavaScript:</span>
<div id="javascript-41">
<div class="javascript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #003366; font-weight: bold;">var</span> mainNav = $<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'#main_nav a'</span><span style="color: #66cc66;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p><strong>eq()</strong> will filter your selection down to one element <strong>eq(1)</strong> will select the second element since the jQuery object that is returned by $('#main_nav a') is basically a zero based array.</p>
<div class="igBar"><span id="ljavascript-42"><a href="#" onclick="javascript:showPlainTxt('javascript-42'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">JavaScript:</span>
<div id="javascript-42">
<div class="javascript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">mainNav.<span style="color: #006600;">eq</span><span style="color: #66cc66;">&#40;</span><span style="color: #CC0000;color:#800000;">1</span><span style="color: #66cc66;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>A combination of <strong>eq </strong>and <strong>hasClass</strong>; <strong>hasClass </strong>is exacly what it sounds like, it checks the element to see if it has a class of "selected" and returns true if it does have that class</p>
<div class="igBar"><span id="ljavascript-43"><a href="#" onclick="javascript:showPlainTxt('javascript-43'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">JavaScript:</span>
<div id="javascript-43">
<div class="javascript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">mainNav.<span style="color: #006600;">eq</span><span style="color: #66cc66;">&#40;</span><span style="color: #CC0000;color:#800000;">1</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">hasClass</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'selected'</span><span style="color: #66cc66;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Once again, a combination of <strong>eq </strong>and <strong>is</strong>; <strong>is </strong>simply checks the element in question against the expression in the brackets and returns true if is has the class selected or if the tag is A</p>
<div class="igBar"><span id="ljavascript-44"><a href="#" onclick="javascript:showPlainTxt('javascript-44'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">JavaScript:</span>
<div id="javascript-44">
<div class="javascript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">mainNav.<span style="color: #006600;">eq</span><span style="color: #66cc66;">&#40;</span><span style="color: #CC0000;color:#800000;">1</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #000066; font-weight: bold;">is</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'.selected'</span><span style="color: #66cc66;">&#41;</span>; <span style="color: #009900; font-style: italic;">// checks for class of selected</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">mainNav.<span style="color: #006600;">eq</span><span style="color: #66cc66;">&#40;</span><span style="color: #CC0000;color:#800000;">1</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #000066; font-weight: bold;">is</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'a'</span><span style="color: #66cc66;">&#41;</span>; <span style="color: #009900; font-style: italic;">// checks to see element is an A tag </span></div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Checks to see if element has text in it of "special text" returns true if it has that text</p>
<div class="igBar"><span id="ljavascript-45"><a href="#" onclick="javascript:showPlainTxt('javascript-45'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">JavaScript:</span>
<div id="javascript-45">
<div class="javascript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">mainNav.<span style="color: #006600;">eq</span><span style="color: #66cc66;">&#40;</span><span style="color: #CC0000;color:#800000;">1</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #000066; font-weight: bold;">is</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">':contains(special text)'</span><span style="color: #66cc66;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p><strong>.not()</strong> will return elements that do <strong>not</strong> match the expression.</p>
<div class="igBar"><span id="ljavascript-46"><a href="#" onclick="javascript:showPlainTxt('javascript-46'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">JavaScript:</span>
<div id="javascript-46">
<div class="javascript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">mainNav.<span style="color: #006600;">not</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'.active'</span><span style="color: #66cc66;">&#41;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>So if you were to put a class of active on one of the links, that call will return all links in mainNav that you did <strong>not </strong>put a class of active.</p>
<h3>Closing</h3>
<p>Ok, I wanted to keep this short and point out some of the items I personally deal with and some items that I get asked about daily.  There are a few other items that I will address in another post that will make your life easier.</p>
<p>If there is anything with the above you don't under stand or, god forbid, I got incorrect, please feel free to drop me a line.</p>

<p><a href="http://feeds.feedburner.com/~a/benjaminsterling?a=ddqDER"><img src="http://feeds.feedburner.com/~a/benjaminsterling?i=ddqDER" border="0"></img></a></p>]]></content:encoded>
			<wfw:commentRss>http://benjaminsterling.com/better-jquery-code-1/feed/</wfw:commentRss>
		<feedburner:origLink>http://benjaminsterling.com/better-jquery-code-1/</feedburner:origLink></item>
		<item>
		<title>Learning from your mistakes</title>
		<link>http://feeds.feedburner.com/~r/benjaminsterling/~3/421192795/</link>
		<comments>http://benjaminsterling.com/learning-from-your-mistakes/#comments</comments>
		<pubDate>Wed, 15 Oct 2008 04:10:50 +0000</pubDate>
		<dc:creator>Benjamin Sterling</dc:creator>
		
		<category><![CDATA[Ramblings]]></category>

		<category><![CDATA[Tips]]></category>

		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://benjaminsterling.com/?p=95</guid>
		<description><![CDATA[credit: AdamNF
Imagine this, you are a seasoned web developer and have encountered just about every situation as a developer.  Now imagine that an unseasoned developer, not quite under your care, stresses that something that is overly basic - as a seasoned developer it would be overly basic - can't be done or require just way [...]]]></description>
			<content:encoded><![CDATA[<div class="featureImg"><a href="http://benjaminsterling.com/wp-content/uploads/2008/10/2424992539_5caf3d4e61.jpg"><img class="aligncenter size-full wp-image-96" title="ARG!" src="http://benjaminsterling.com/wp-content/uploads/2008/10/2424992539_5caf3d4e61.jpg" border="0" alt="Frustration" width="610" /></a></div>
<p style="text-align:right;">credit: <a href="http://flickr.com/photos/adampenney/">AdamNF</a></p>
<p>Imagine this, you are a seasoned web developer and have encountered just about every situation as a developer.  Now imagine that an unseasoned developer, not quite under your care, stresses that something that is overly basic - as a seasoned developer it would be overly basic - can't be done or require just way to much time to achieve.  Now imagine since this developer can't (or won't) do this overly simple task you now have to take this project on your shoulders and spend countless hours recoding close to 500 lines of code plus add an extra 300 lines of bloat - all of which are against your better judgment and coding philosophy -  to achieve the goals for this project.   How would you react?  What would you do?  Well, I will tell you how I originally reacted and what I eventually did.</p>
<blockquote class="quote"><p>My initial reaction was poor, very poor and embarrassing, I flipped out and stopped short of calling him name.</p></blockquote>
<p>My initial reaction was poor, very poor and embarrassing, I flipped out and stopped short of calling him name.  I did yell, which I never do.  When the project was start all requirements were laid out and I explicitly told the developer exactly what I needed and made him repeat those needs back to me.  I also ask him what he need from me and I confirmed those items with him in emails, in person and on conference calls.  So when you get a call on a Sunday afternoon stating that you have recode code that has been done for over a month and a half that has been tested and was working a 100%,  getting mad is just about all you can do.  So I yelled and cursed; recited email after email, notes after notes about prior discussions and what was agreed on.</p>
<p>Like I said, reacted very poorly.  After this call I stepped outside to collect myself and get my thoughts together.  Once I calmed down I decided that I would treat this situation as if I were back being a supervisor at <abbr title="United Parcel Service">UPS</abbr>.  What made me one of the best - if not the best - supervisors at UPS was my ability to train, cross-train, communicate and making my employees think that my ideas were actually their ideas.</p>
<blockquote class="quote"><p>...debating only waste time and will frustrate you.</p></blockquote>
<p>I went ahead and did all the recoding and set things up to have this developer come up with my ideas.  At UPS having someone come up with your idea was pretty easy, it's manual labor so convincing someone to do something smart not hard is quite simple.  Convincing a person that sits in front of a keyboard that you never see (I telecommute) to work smarter, not harder is complicated.  I had to keep in constant communication with him and our supervisor - our supervisor works in the office with him and can relay messages to him without making it seem like it came from me.  In these communications I had to bring up a small problem that only really had one outcome and would be the outcome I was looking for.  Much like a lawyer should never ask a question they don't already know the answer too, I made sure to ask questions that only benefited my philosophy.  I tried to stay away from items that I knew would cause a debate, even if in my mind it was a simple topic, debating only waste time and will frustrate you.</p>
<p>After about three weeks - yes, three weeks is a long time but keep in mind that I don't see this person everyday and I am working four other projects so very little time to focus - we were getting complaints that the app was moving too slow.  Which was one of the seeds I was planting over the three weeks was about load time and processing time.  I had gone into the office to discuss everything face to face with him and our supervisor to see "what we can do to fix it."  I had planted quite a few seeds so all I really needed to do at this point was to add water.  Water in this instance was me walking thru that app looking ever-so frustrated that I could not come up with an answer on fixing it.  I start out by pointing out the the obvious, the page took too long to load and once we were sure everything was loaded there was still a hand in the app.  The load time was do to a massive XML document being loaded, well over 4,000 lines, and the hand was the bloated code I needed to put in to achieve what this developer could not do on his end.</p>
<p>Before I go further, let me clear up who is doing what.  I am, on this project, the front end developer dealing with the JavaScript framework I build on top of jQuery, building out the design and making it 508 compliant.  He is building a CMS of sorts to maintain and track the content.  When I say track, I mean the content can be versioned and have comments for changes appended to it.  He is building everything out in ASP.NET.</p>
<blockquote class="quote"><p>...sometimes you have to baby step people till the see the big picture.</p></blockquote>
<p>After pointing out exact what might be causing the load time and the hand, xml and the code bloat, I suggested something simple for the load time in the form of a question to the developer.  "What would happen if we shrunk the tag name for one specific tag in the XML down to one letter?"  He was like "Hmmm... the change would be pretty easy on my end, maybe we comment out some attributes that are not needed."  And that is where he started taking off with the idea (please note, this was one of the ideas I've been pushing from the very beginning but its only a band-aide to a bigger problem.  Baby steps.) and shrinking the other tags.  Basically were shrank a 500kb file down to 250kb, not great, but a huge improvement, remember, sometimes you have to baby step people till the see the big picture.</p>
<p>Once we got that particular issue "resolved" it was time to move onto issue two, the code bloat.  When I coded this I made sure to make it expendable, the moment it was not needed anymore it was gone.  The framework basically works off the hash by default, much like gmail does so you can go back and forth in your history.  But instead of sending me the hash as my code expects, he was sending me an ID of the page and I had to transverse the XML to build out the needed hash.  But before I had the chance to start explaining the problem and how we "might" resolve it he blurts out "Oh, I think I can just send you the hash.  Shouldn't be to hard."  I litterally sat there with my mouth open for what felt like an hour.  To rehash, the number one issue that he was unable to do was the building out of the hash.  For those that don't know, a hash is what you see in your URI (#somehash).  In our case, the hash looks like #m-1000-0-0-0 which is #m-Module-lesson-topic-page; its zero based so 0 is the first lesson/topic/page, 1 is the second and so on.</p>
<p>So what did we learn here?  Well, a few things.</p>
<p><strong>For Senior Developers:</strong></p>
<ol>
<li>Communicate</li>
<li>Be willing to let the unseasoned learn from their own mistakes.  You may need to take a hit every now and then but in the end the unseasoned will become season and an asset.</li>
<li>You are allowed to get mad and frustrated, but keep your composure.  Step outside and take a breather if you need, but keep your cool and be a leader.</li>
<li>You made your mistakes to get where you are at, so remember that when the unseasoned make a mistake that makes your work harder to do.</li>
<li>Be willing to teach, that kinda goes hand in hand with letting the unseasoned make mistakes, but the difference here is preemptive.  If you have an opportunity to truly explain why something is done a certain way, do it.</li>
</ol>
<p><strong>For Juniour/Entry level Developers</strong></p>
<ol>
<li>Communicate</li>
<li>Learn from your mistakes; don't make the same ones over and over again.</li>
<li>Understand that people will get frustrated with you if you "don't know everything they know."  But be willing to ask for help.  99% of the time that will bring the frustration level down and give them an ego boost.</li>
<li>This one bares repeating: Learn from your mistakes; don't make the same ones over and over again.</li>
<li>Be willing to learn.  Simple as that.  You don't know everything and there is always someone, even for seasoned developers, that knows much more than you.</li>
</ol>

<p><a href="http://feeds.feedburner.com/~a/benjaminsterling?a=IveRwv"><img src="http://feeds.feedburner.com/~a/benjaminsterling?i=IveRwv" border="0"></img></a></p>]]></content:encoded>
			<wfw:commentRss>http://benjaminsterling.com/learning-from-your-mistakes/feed/</wfw:commentRss>
		<feedburner:origLink>http://benjaminsterling.com/learning-from-your-mistakes/</feedburner:origLink></item>
		<item>
		<title>A Call For Feature Requests: An Events Manager</title>
		<link>http://feeds.feedburner.com/~r/benjaminsterling/~3/313510503/</link>
		<comments>http://benjaminsterling.com/a-call-for-feature-requests-an-events-manager/#comments</comments>
		<pubDate>Tue, 17 Jun 2008 03:54:45 +0000</pubDate>
		<dc:creator>Benjamin Sterling</dc:creator>
		
		<category><![CDATA[Wordpress plugin]]></category>

		<guid isPermaLink="false">http://benjaminsterling.com/?p=83</guid>
		<description><![CDATA[One of the features I am being asked for lately from clients is to have an events manager created for them.  The requirements vary from project to project but there are quite a few items that they seem want.  Since I mainly deal with WordPress for these project I figured that there must be a [...]]]></description>
			<content:encoded><![CDATA[<p>One of the features I am being asked for lately from clients is to have an events manager created for them.  The requirements vary from project to project but there are quite a few items that they seem want.  Since I mainly deal with WordPress for these project I figured that there must be a plugin already create that will fit the bill and I have search the web and found many versions of a events manager, but none of them seem to just work.</p>
<p>With that said, I am looking to build one, I already have a decent footprint down but I know there are many features that should be included.  Mind you, they should not all be turned on at first, but the end user should be able to turn some on and some off to fit their needs.</p>
<p>So my question to you is, what features would you like to see in a WordPress Events Manager plugin?  I have quite a few ideas myself but I don't want to taint your opinion.  Leave your comment below and lets discuss.</p>
<p>If you are interested in helping in anyway, let me know and maybe we can sync up.</p>

<p><a href="http://feeds.feedburner.com/~a/benjaminsterling?a=feRexo"><img src="http://feeds.feedburner.com/~a/benjaminsterling?i=feRexo" border="0"></img></a></p>]]></content:encoded>
			<wfw:commentRss>http://benjaminsterling.com/a-call-for-feature-requests-an-events-manager/feed/</wfw:commentRss>
		<feedburner:origLink>http://benjaminsterling.com/a-call-for-feature-requests-an-events-manager/</feedburner:origLink></item>
		<item>
		<title>Announcing the WordPress Image Browser Extender Plugin</title>
		<link>http://feeds.feedburner.com/~r/benjaminsterling/~3/313264565/</link>
		<comments>http://benjaminsterling.com/announcing-the-wordpress-image-browser-extender-plugin/#comments</comments>
		<pubDate>Mon, 16 Jun 2008 19:49:40 +0000</pubDate>
		<dc:creator>Benjamin Sterling</dc:creator>
		
		<category><![CDATA[Wordpress]]></category>

		<category><![CDATA[Wordpress plugin]]></category>

		<category><![CDATA[Plugin]]></category>

		<guid isPermaLink="false">http://benjaminsterling.com/?p=80</guid>
		<description><![CDATA[I am pleased to another WordPress plugin geared toward improving the functionality and usability of WordPress' admin area.  This plugin will extend the functionality of the richtext editor to include the ability to browse thru all your images that have been uploaded to your WordPress install.
Feel free to check it out at Image Browser [...]]]></description>
			<content:encoded><![CDATA[<p>I am pleased to another WordPress plugin geared toward improving the functionality and usability of WordPress' admin area.  This plugin will extend the functionality of the richtext editor to include the ability to browse thru all your images that have been uploaded to your WordPress install.</p>
<p>Feel free to check it out at <a href="http://benjaminsterling.com/wordpress-image-browser-extender/">Image Browser Extenders page</a> and download it from the <a href="http://wordpress.org/extend/plugins/image-browser-extender/">WordPress extend site</a>.</p>
<p>Some screen shots to hold you over:</p>
<p><a href="http://benjaminsterling.com/wp-content/uploads/2008/06/imageextender.png"><img class="alignnone size-thumbnail wp-image-82" style="border: 0pt none; margin: 5px;" title="imageextender" src="http://benjaminsterling.com/wp-content/uploads/2008/06/imageextender-150x150.png" alt="" width="150" height="150" /></a><a href="http://benjaminsterling.com/wp-content/uploads/2008/06/imageextender2.png"><img class="alignnone size-thumbnail wp-image-81" style="border: 0pt none; margin: 5px;" title="imageextender2" src="http://benjaminsterling.com/wp-content/uploads/2008/06/imageextender2-150x150.png" alt="" width="150" height="150" /></a></p>

<p><a href="http://feeds.feedburner.com/~a/benjaminsterling?a=AcXGk8"><img src="http://feeds.feedburner.com/~a/benjaminsterling?i=AcXGk8" border="0"></img></a></p>]]></content:encoded>
			<wfw:commentRss>http://benjaminsterling.com/announcing-the-wordpress-image-browser-extender-plugin/feed/</wfw:commentRss>
		<feedburner:origLink>http://benjaminsterling.com/announcing-the-wordpress-image-browser-extender-plugin/</feedburner:origLink></item>
		<item>
		<title>Announcing the WordPress Editor Extender Plugin</title>
		<link>http://feeds.feedburner.com/~r/benjaminsterling/~3/311906911/</link>
		<comments>http://benjaminsterling.com/announcing-the-wordpress-editor-extender-plugin/#comments</comments>
		<pubDate>Sat, 14 Jun 2008 17:05:29 +0000</pubDate>
		<dc:creator>Benjamin Sterling</dc:creator>
		
		<category><![CDATA[Wordpress]]></category>

		<category><![CDATA[Wordpress plugin]]></category>

		<category><![CDATA[Plugin]]></category>

		<category><![CDATA[richtext editor]]></category>

		<category><![CDATA[usability]]></category>

		<guid isPermaLink="false">http://benjaminsterling.com/?p=77</guid>
		<description><![CDATA[Today I present to you my newest release, a WordPress plugin that adds/extends the functionality of the richtext editor for editing post and pages call Editor Extender.  Fancy name huh?  I am not very creative with my names but I am however creative with my code.  I've been using this plugin in probably about half [...]]]></description>
			<content:encoded><![CDATA[<p>Today I present to you my newest release, a WordPress plugin that adds/extends the functionality of the richtext editor for editing post and pages call Editor Extender.  Fancy name huh?  I am not very creative with my names but I am however creative with my code.  I've been using this plugin in probably about half of the websites I have built using WordPress as its CMS.  Most of my clients needed the table feature or they wanted a button to click to give a line break, enter in dates and so on.</p>
<p>With this plugin adding functionality has become a simple as clicking a few check boxes, no need to fuss with code.  Go ahead and check out the <a href="http://benjaminsterling.com/wordpress-editor-extender/">plugins page</a> or download it from <a href="http://wordpress.org/extend/plugins/editor-extender/">WordPress.org</a>.</p>

<p><a href="http://feeds.feedburner.com/~a/benjaminsterling?a=iDXLFD"><img src="http://feeds.feedburner.com/~a/benjaminsterling?i=iDXLFD" border="0"></img></a></p>]]></content:encoded>
			<wfw:commentRss>http://benjaminsterling.com/announcing-the-wordpress-editor-extender-plugin/feed/</wfw:commentRss>
		<feedburner:origLink>http://benjaminsterling.com/announcing-the-wordpress-editor-extender-plugin/</feedburner:origLink></item>
		<item>
		<title>Annoucing the Attachment Extender for WordPress</title>
		<link>http://feeds.feedburner.com/~r/benjaminsterling/~3/309330266/</link>
		<comments>http://benjaminsterling.com/annoucing-the-attachment-extender-for-wordpress/#comments</comments>
		<pubDate>Wed, 11 Jun 2008 04:00:23 +0000</pubDate>
		<dc:creator>Benjamin Sterling</dc:creator>
		
		<category><![CDATA[Wordpress]]></category>

		<category><![CDATA[Wordpress plugin]]></category>

		<category><![CDATA[Plugin]]></category>

		<guid isPermaLink="false">http://benjaminsterling.com/?p=72</guid>
		<description><![CDATA[Lately I have been do a ton of development with WordPress for use in a few websites as CMS - which I will be doing a few post on at some point - and I found using the Media Library to be a bit lacking.  Not to bash anyone but there just seemed to [...]]]></description>
			<content:encoded><![CDATA[<p>Lately I have been do a ton of development with WordPress for use in a few websites as CMS - which I will be doing a few post on at some point - and I found using the Media Library to be a bit lacking.  Not to bash anyone but there just seemed to be some very basics things that were over looked.</p>
<p>One of which was the ability to update the files you posted, you can edit the titles and captions, you can event delete the file but you can't upload a new version of the file.  You would need to delete and repost the file which is a process not easily communicated to a customer or a wife using WordPress.  So I create the <em><a href="http://benjaminsterling.com/wordpress-attachment-extender/">Attachment Manager</a></em> to fill that void.  What it gives you is the ability to re-upload a new version of a photo or a pdf or what ever you are trying to update without cause a bunch of hardships.</p>
<p>You can grab yourself a copy over at <a href="http://wordpress.org/extend/plugins/attachment-extender/">http://wordpress.org/extend/pl.....-extender/</