<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>The Book and the Cover &#187; Web Development</title>
	<atom:link href="http://benjaminsterling.com/category/web-development/feed/" rel="self" type="application/rss+xml" />
	<link>http://benjaminsterling.com</link>
	<description>Ok, you did not judge the book by it&#039;s cover, great.  Now, read the whole thing before passing judgment.</description>
	<lastBuildDate>Mon, 16 Jan 2012 21:58:18 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>IE6 Support</title>
		<link>http://benjaminsterling.com/ie6-support/</link>
		<comments>http://benjaminsterling.com/ie6-support/#comments</comments>
		<pubDate>Tue, 24 Mar 2009 19:25:03 +0000</pubDate>
		<dc:creator>Benjamin Sterling</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[IE6]]></category>
		<category><![CDATA[IE8]]></category>

		<guid isPermaLink="false">http://benjaminsterling.com/?p=142</guid>
		<description><![CDATA[With the launch of Internet Explorer 8 last week there has been a good amount of talk for support for IE6. At my company we are currently discussing the best approach that will both keep the client happy at the same time forcing people to upgrade their expectations of a browser. Some thoughts have been [...]]]></description>
			<content:encoded><![CDATA[<p>With the launch of Internet Explorer 8 last week there has been a good amount of talk for support for IE6.  At my company we are currently discussing the best approach that will both keep the client happy at the same time forcing people to upgrade their expectations of a browser.  Some thoughts have been to charge a premium to support IE6 &#8211; whether this is a percentage of total expect hours for a project or a flat rate based on the requirements , the difference being building with IE6 in mind compared to progressive enhancements after the fact.  Obviously my team has pride in our work so we most likely would be building to some extent with IE6 in mind either way.</p>
<p>The following stats are some questions I posted surveying a large group of people.</p>
<h3>What do you fall under?</h3>
<table width="600" cellpadding="0" cellspacing="3" id="jobtype" class="datatable">
<thead>
<tr>
<th width="475">Response</th>
<th>Total</th>
<th>Percent</th>
<th></th>
</tr>
</thead>
<tbody>
<tr>
<td>Developer</td>
<td>117</td>
<td>54.93%</td>
<td></td>
</tr>
<tr>
<td>Designer</td>
<td>78</td>
<td>36.62%</td>
<td></td>
</tr>
<tr>
<td>Profession (ie. PM, Director)</td>
<td>18</td>
<td>8.45%</td>
<td></td>
</tr>
</tbody>
<tfoot>
<tr>
<td></td>
<td><strong>213</strong></td>
<td></td>
<td></td>
</tr>
</tfoot>
</table>
<div id="defaultChart" style="width: 600px; height: 200px;margin-bottom:2em;"></div>
<h3>What type of client do you support?</h3>
<table width="600" cellpadding="0" cellspacing="3" id="" class="datatable">
<thead>
<tr>
<th width="475">Response</th>
<th>Total</th>
<th>Percent</th>
<th></th>
</tr>
</thead>
<tbody>
<tr>
<td>Commercial (big companies)</td>
<td>84</td>
<td>32.81%</td>
<td></td>
</tr>
<tr>
<td>Mom and Pop type clients</td>
<td>84</td>
<td>32.81%</td>
<td></td>
</tr>
<tr>
<td>Non-Profits</td>
<td>58</td>
<td>22.66%</td>
<td></td>
</tr>
<tr>
<td>Government</td>
<td>30</td>
<td>11.72%</td>
<td></td>
</tr>
</tbody>
<tfoot>
<tr>
<td></td>
<td><strong>256</strong></td>
<td></td>
<td></td>
</tr>
</tfoot>
</table>
<div id="defaultChart2" style="width: 600px; height: 200px;margin-bottom:2em;"></div>
<h3>How long will you/your group support IE6?</h3>
<table width="600" cellpadding="0" cellspacing="3" id="" class="datatable">
<thead>
<tr>
<th width="475">Response</th>
<th>Total</th>
<th>Percent</th>
<th></th>
</tr>
</thead>
<tbody>
<tr>
<td>Umm&#8230; IE6 who?</td>
<td>50</td>
<td>24.27%</td>
<td></td>
</tr>
<tr>
<td>Till what seems like the end of time (or till gov&#8217;t offices update)</td>
<td>53</td>
<td>25.73%</td>
<td></td>
</tr>
<tr>
<td>Another 6 months, then progressive inhancements FTW</td>
<td>26</td>
<td>12.62%</td>
<td></td>
</tr>
<tr>
<td>Another 6 months, then not at all</td>
<td>24</td>
<td>11.65%</td>
<td></td>
</tr>
<tr>
<td>Another year, then progressive inhancements FTW</td>
<td>14</td>
<td>6.8%</td>
<td></td>
</tr>
<tr>
<td>Other Options</td>
<td>39</td>
<td>18.93%</td>
<td></td>
</tr>
</tbody>
<tfoot>
<tr>
<td>
<ul style="display:none;">
<li>Other Text</li>
<li>We only suppport it for clients that ask for it.</li>
<li>As soon as Windows 7 OS is released to the public</li>
<li>until our internal IT team drops 6</li>
<li>when full experience is needed for ie6 clients, otherwise prog. enhancement now</li>
<li>Bare minimum now (works, may not look 100% perfect) unless there is extra budget for it.</li>
<li>As long as there is a business requirement to do so</li>
<li>As long as my damn clients still have it on their desks</li>
<li>Until enough of our client&#8217;s client&#8217;s no longer use IE6.</li>
<li>unsure, our clients are often not tech savvy</li>
<li>only when target audience uses</li>
<li>We only suppport it for clients that ask for it.</li>
<li>As soon as Windows 7 OS is released to the public</li>
<li>until our internal IT team drops 6</li>
<li>when full experience is needed for ie6 clients, otherwise prog. enhancement now</li>
<li>Bare minimum now (works, may not look 100% perfect) unless there is extra budget for it.</li>
<li>As long as there is a business requirement to do so</li>
<li>As long as my damn clients still have it on their desks</li>
<li>Until enough of our client&#8217;s client&#8217;s no longer use IE6.</li>
<li>unsure, our clients are often not tech savvy</li>
<li>only when target audience uses</li>
<li>IE7.js</li>
<li>Once our IE6 usership drops below 5%</li>
<li>Depends on user agent stats to my clients&#8217; sites</li>
<li>I detect IE6, then redirect visitor to page &#8216;gently&#8217; suggesting they upgrade to a better browser (with links to Firefox, Opera, Safari, Chrome, and IE7/8)</li>
<li>Until it holds a significantly lower Market share that we can profesionaly ignore it</li>
<li>Already stopped</li>
<li>until we replace expensive legacy apps that rely on IE6 for some reason</li>
<li>Untill ie8 becomes as involved as ie6</li>
<li>until IE6 market share drops below 5%</li>
<li>We only provide basic support as a opt-in feature.</li>
<li>Till clients stop using it.</li>
<li>we get the basics working, anything else is a bonus</li>
<li>Already dropped support</li>
<li>I simply try to ignore IE6 =)</li>
<li>I can&#8217;t say. My clients still see traffic from IE6.</li>
<li>progressive inhancements FTW already</li>
<li>ceased support 1st Jan 2009</li>
<li>No more support DIE IE6!</li>
</ul>
</td>
<td valign="top"><strong>206</strong></td>
<td></td>
<td></td>
</tr>
</tfoot>
</table>
<div id="defaultChart3" style="width: 600px; height: 200px;margin-bottom:2em;"></div>
<h3>If you have to support government agencies, how do you plan to tackle the IE6 issue?</h3>
<table width="600" cellpadding="0" cellspacing="3" id="" class="datatable">
<thead>
<tr>
<th width="475">Response</th>
<th>Total</th>
<th>Percent</th>
<th></th>
</tr>
</thead>
<tbody>
<tr>
<td>Will support, but with a IE6 cost adjustment, ie. charge more</td>
<td>93</td>
<td>52.84%</td>
<td></td>
</tr>
<tr>
<td>Just keep doing what we do</td>
<td>75</td>
<td>42.61%</td>
<td></td>
</tr>
<tr>
<td>Other Options</td>
<td>8</td>
<td>4.55%</td>
<td></td>
</tr>
</tbody>
<tfoot>
<tr>
<td>
<ul style="display:none">
<li>Other Text</li>
<li>Since I work for a govt agency I don&#8217;t really have a choice.  Supposedly IE7 will be released soon but they&#8217;ve been saying that forever.  Until then, its all about progressive enhancement</li>
<li>I don&#8217;t pay taxes so govt. agencies can use browsers like IE6.</li>
<li>Since I work for a govt agency I don&#8217;t really have a choice.  Supposedly IE7 will be released soon but they&#8217;ve been saying that forever.  Until then, its all about progressive enhancement</li>
<li>I don&#8217;t pay taxes so govt. agencies can use browsers like IE6.</li>
<li>n/a</li>
<li>IE MUST DIE!!!!!</li>
<li>I dont</li>
</ul>
</td>
<td><strong>176</strong></td>
<td></td>
<td></td>
</tr>
</tfoot>
</table>
<div id="defaultChart4" style="width: 600px; height: 200px;margin-bottom:2em;"></div>
<h3>How does having IE8 available effect your process?</h3>
<table width="600" cellpadding="0" cellspacing="3" id="">
<thead>
<tr>
<th width="475">Response</th>
<th></th>
</tr>
</thead>
<tr>
<td>
<ul>
<li>How does having IE8 available effect your process?</li>
<li>Response</li>
<li>Doesn&#8217;t</li>
<li>It makes it worse. Now we have THREE versions of IE to test in!!!</li>
<li>Not at all, just one more browser to test for.</li>
<li>It doesn&#8217;t.  We don&#8217;t even have IE7 deployed across our agency.</li>
<li>definitely gives us more leverage for dropping IE6</li>
<li>not at all until mass adoption</li>
<li>We have not setup a plan yet but are planning currently</li>
<li>just another browser to debug in.Also, should be noted that IE 7 is considered &#8216;buggy&#8217; and &#8216;unsafe&#8217; by most corporate IT services including AOL and Time Warner</li>
<li>Not at all.</li>
<li>Hopefully it helps fight our cause for stopping IE6 support</li>
<li>It&#8217;ll just mean one more browser to test in.</li>
<li>Currently, not at all. The bigwigs at my company have yet to recognize it.</li>
<li>We&#8217;ll add X-UA-Compatible = Edge headers, and fix IE8 rendering issues that we might have ignored while it was still in beta.</li>
<li>None until the % of IE6 users drops below a certain threshold.</li>
<li>It&#8217;s just yet another browser to support. No difference.</li>
<li>It doesn&#8217;t</li>
<li>Doesn&#8217;t. The gov has IE6.</li>
<li>allows me to shame IE6 users more.</li>
<li>It complicates itâ€”there&#8217;s now another browser to test against. It wouldn&#8217;t be such a problem if the IEs weren&#8217;t so annoyingly different from version-to-version.</li>
<li>We told IE6 to take a hike months ago. IE8&#8242;s just another browser to test.</li>
<li>One more crappy browser to deal with.</li>
<li>It doesn&#8217;t yet.  We&#8217;ll use IE6 internally until 2056.I do internal web apps, and I wish we could code to more than IE6 though&#8230; it&#8217;s more of an impediment to professional development than anything else. I can only code/use other browsers outside of work.</li>
<li>Not much.  If it&#8217;s truly standards compliant, then we&#8217;ll still have to use IE specific stylesheets and little hacks for users who have 7 and below.</li>
<li>Not much at all, thankfully. Just one more browser to test.</li>
<li>Afraid to see how crappy it is, can not answer that</li>
<li>We are not rolling it out until after our applications have been certified for user with them. They currently are not.</li>
<li>It makes me have to test for another fucking browser. Fuck!</li>
<li>i don&#8217;t know for now, but i&#8217;m expecting for some trouble in near future</li>
<li>it doesnt</li>
<li>Other than giving me one more browser to test in, it doesn&#8217;t.</li>
<li>We don&#8217;t get to play with it because the site is adamant that they WILL deploy IE7 (and Vista) first, just to fark everything up, instead of jumping straight to Win7 and IE8 or FF.</li>
<li>Doesn&#8217;t</li>
<li>It makes it worse. Now we have THREE versions of IE to test in!!!</li>
<li>Not at all, just one more browser to test for.</li>
<li>It doesn&#8217;t.  We don&#8217;t even have IE7 deployed across our agency.</li>
<li>definitely gives us more leverage for dropping IE6</li>
<li>not at all until mass adoption</li>
<li>We have not setup a plan yet but are planning currently</li>
<li>just another browser to debug in.Also, should be noted that IE 7 is considered &#8216;buggy&#8217; and &#8216;unsafe&#8217; by most corporate IT services including AOL and Time Warner</li>
<li>Not at all.</li>
<li>Hopefully it helps fight our cause for stopping IE6 support</li>
<li>It&#8217;ll just mean one more browser to test in.</li>
<li>Currently, not at all. The bigwigs at my company have yet to recognize it.</li>
<li>We&#8217;ll add X-UA-Compatible = Edge headers, and fix IE8 rendering issues that we might have ignored while it was still in beta.</li>
<li>None until the % of IE6 users drops below a certain threshold.</li>
<li>It&#8217;s just yet another browser to support. No difference.</li>
<li>It doesn&#8217;t</li>
<li>Doesn&#8217;t. The gov has IE6.</li>
<li>allows me to shame IE6 users more.</li>
<li>It complicates itâ€”there&#8217;s now another browser to test against. It wouldn&#8217;t be such a problem if the IEs weren&#8217;t so annoyingly different from version-to-version.</li>
<li>We told IE6 to take a hike months ago. IE8&#8242;s just another browser to test.</li>
<li>One more crappy browser to deal with.</li>
<li>It doesn&#8217;t yet.  We&#8217;ll use IE6 internally until 2056.I do internal web apps, and I wish we could code to more than IE6 though&#8230; it&#8217;s more of an impediment to professional development than anything else. I can only code/use other browsers outside of work.</li>
<li>Not much.  If it&#8217;s truly standards compliant, then we&#8217;ll still have to use IE specific stylesheets and little hacks for users who have 7 and below.</li>
<li>Not much at all, thankfully. Just one more browser to test.</li>
<li>Afraid to see how crappy it is, can not answer that</li>
<li>We are not rolling it out until after our applications have been certified for user with them. They currently are not.</li>
<li>It makes me have to test for another fucking browser. Fuck!</li>
<li>i don&#8217;t know for now, but i&#8217;m expecting for some trouble in near future</li>
<li>it doesnt</li>
<li>Other than giving me one more browser to test in, it doesn&#8217;t.</li>
<li>We don&#8217;t get to play with it because the site is adamant that they WILL deploy IE7 (and Vista) first, just to fark everything up, instead of jumping straight to Win7 and IE8 or FF.</li>
<li>Sure does!</li>
<li>Frankly it&#8217;s just another pain in the ass. It just adds another browser to test on. It&#8217;s already not a short list</li>
<li>Just one more browser to test in&#8230; :(</li>
<li>Hopefully will lead us into an age where IE6 WILL be outlawed&#8230; or something like that.</li>
<li>na</li>
<li>Not yet&#8230; but we&#8217;ll likely focus on IE7 and IE8 soon and less and less on IE6.</li>
<li>Just makes it more complicated, I guess!</li>
<li>no effect.</li>
<li>We will have to start testing in it, although the priority on the fixes will be much lower that FF, IE6/7 and Safari.</li>
<li>It doesn&#8217;t. It just came out, need to wait 6 months to a year for people to update. Still can&#8217;t use some things until even IE 7 is dead.</li>
<li>We will now check in IE8</li>
<li>just another browser to test in</li>
<li>One more browser for test</li>
<li>Sigh.</li>
<li>Just one more browser to QA and tweak for.</li>
<li>Another VM with another browser to test in&#8230; more development time.</li>
<li>As we primary design for FF, not very much.</li>
<li>Not yet.</li>
<li>It hasn&#8217;t at the moment. Will now download as IE8 is out of beta</li>
<li>Adds one more browser to test once we find a machine to put it on.</li>
<li>IE8 doesn&#8217;t affect things until it becomes more popular. Then I&#8217;ll need to add it to the list of browsers to test in.</li>
<li>First of all, it&#8217;s *affect* not &#8216;effect&#8217;.  Effect means &#8216;bring about&#8217; or &#8216;make happen&#8217;.  (Sorry, my mom was an English teacher!).Second, the IE8 beta&#8217;s been around for what, a year now?  So having the actual release doesn&#8217;t make much of a difference to my development process.  Although I suppose I should pay attention now to making sure the sites I build look proper in IE8, the reality is that the vast majority of my clients&#8217; visitors won&#8217;t be using IE8 just yet, unless Microsoft forces it down their throats via a non-optional update.</li>
<li>Until the people in charge of Corporate IT networks pull their fingers out, it makes zero difference</li>
<li>not sure yet :)</li>
<li>IE8 will continue to be the worst browser. It is less bad than IE6, however.</li>
<li>I need another desktop to test for IE8, the way I already have one just for IE7 testing&#8230;can&#8217;t do some of the fancy tricks here at work to get them up side by side</li>
<li>Still renders differntly, ie7 still seems easier to deal with</li>
<li>It lengthens the time spent on IE-fixing Â¬Â¬</li>
<li>Doesn&#8217;t really effect it.  One more browser to test in but it&#8217;s the closest to standards so far.</li>
<li>we make our website the more cross browser possible. It&#8217;s just another test we must do.</li>
<li>It doesn&#8217;t. If it&#8217;s standards-compliant, it should work fine anyway. If it&#8217;s not&#8230;DIE!!!!</li>
<li>Not right now. Many of my clients are small businesses. Main focus on IE7 and some IE6 right now. But this will change soon.</li>
<li>one more effing browser to test in. and an effing Microsoft browser no less</li>
<li>It&#8217;s just another site to test it. It also means I can push a bit farther into the realm of CSS3.</li>
<li>Nothing now as everything we do already works in 8, but hopefully it effects our clients process, getting them to upgrade from 6.</li>
<li>Just another browser to test.</li>
<li>just another browser we have to test in.</li>
<li>It&#8217;s actually a kick in the pants, but not because of IE8 itself, but rather its IE7 &#8216;compatibility&#8217; mode. Since, that mode won&#8217;t render the way IE7 itself renders, it effectively adds another browser to test and support.</li>
<li>it doesn&#8217;t really yet.</li>
<li>test</li>
<li>We&#8217;ll have another browser in which to test, and another stylesheet to implement should the need arise (via conditional comments)</li>
<li>So far not at all. It seems to be working well.</li>
<li>At least it is somewhat compliant but is already behind the curve without CSS3 support. So many people that use IE don&#8217;t even know what version they are using so unless microsoft forces a change my life will still be burdened by the plagues that is know as IE. I only see a minimal change in the near term to my process.</li>
<li>it makes debugging for ie7 and 8 easier</li>
<li>Haven&#8217;t really tested in IE8. I&#8217;m fairly confident that the majority of work will be OK. Will need to look more closely at what I must do to ensure standards compliance mode.I&#8217;ve been watching site stats and I think across all the sites I manage I&#8217;ve had 2 or 3 visits from IE8</li>
<li>One more browser to test in.</li>
<li>Well. I&#8217;m hoping that with the news of IE8 some people will upgrade after realizing there has been two major versions of the browser released. In the end I hope it will keep me from spending a ton of time fixing the site for IE6.</li>
<li>Minimal</li>
<li>not sure yet</li>
<li>hmmmm. it is a microsoft product. need I really say more. I will likely have to hack on</li>
<li>It&#8217;s another browser to test again, but so far the testing process seems pretty straightforward. I expect that having implemented CSS2.1 properly will mean that it won&#8217;t impose too much change in our process. Of course, in theory.</li>
<li>Makes developing for these kind of platforms a lot easier. Less time concerning stupid errors and glitches specific to IE platform.</li>
<li>Makes more problems to deal with.</li>
<li>Doesn&#8217;t effect</li>
<li>Hope, IE6 will die.</li>
<li>Hardly at all. I mostly test in webkit and mozilla browsers then when the page is done I see if everything works okay in the IE 6-8 and include conditional stylesheets to work around the &#8216;bugs&#8217;.</li>
<li>Not at all. IE7 only recently became our officially supported browser. As much as I hate to say it, I don&#8217;t expect to see IE8 in our environment for some time.</li>
<li>Saves me and the client money</li>
<li>Yet another browser to test in.</li>
<li>Don&#8217;t know yet.</li>
<li>None really because it&#8217;s too new</li>
<li>Just one more browser to test on. Hopefully that slice of IE6 will keep shrinking. Is it worth testing for if it gets under 10%? Most of my clients audience has already moved on to IE7+</li>
<li>It has yet to affect us. I&#8217;m terrified when we start supporting it.</li>
<li>Still trying to sort that out.</li>
<li>it creates more work. IE8 compatibility view is not the same as a native IE7 client so now we have to work with even more cross-browser issues.</li>
<li>Doesn&#8217;t really.  There have always been browser inconsistencies to deal with, with IE8 there are some more.Only in my dreams do all browsers render the same.</li>
<li>I usually use the IE7 compatibility meta tag. So, IE8 is more like a pseudo-ghost to me anyways.</li>
<li>It hasn&#8217;t so far.</li>
<li>Better than IE6!</li>
<li>No</li>
<li>not at all so far&#8230;</li>
<li>Just another rushed out browser that has to be entered into the equation and bugtested for each project</li>
<li>Ugh, just another idiot browser to maintain..</li>
</ul>
</td>
<td></td>
</tr>
</table>
<h3>Are your sites working in IE8?</h3>
<table width="600" cellpadding="0" cellspacing="3" id="" class="datatable">
<thead>
<tr>
<th width="475">Response</th>
<th>Total</th>
<th>Percent</th>
<th></th>
</tr>
</thead>
<tbody>
<tr>
<td>Yes</td>
<td>133</td>
<td>63.94%</td>
<td></td>
</tr>
<tr>
<td>No</td>
<td>8</td>
<td>3.85%</td>
<td></td>
</tr>
<tr>
<td>Other Options</td>
<td>67</td>
<td>32.21%</td>
<td></td>
</tr>
</tbody>
<tfoot>
<tr>
<td>
<ul style="display:none">
<li>Other Text</li>
<li>dunno</li>
<li>most, but not all</li>
<li>Haven&#8217;t tested yet.</li>
<li>have not been actively qa&#8217;ing for ie8</li>
<li>Don&#8217;t know</li>
<li>untested</li>
<li>Haven&#8217;t tested yet.</li>
<li>Still checking</li>
<li>Have not checked</li>
<li>not sure</li>
<li>Haven&#8217;t even tested yet</li>
<li>Internal NO, External Yes</li>
<li>testing this week</li>
<li>have no ieda</li>
<li>I&#8217;ve not played with IE 8 much</li>
<li>dunno</li>
<li>most, but not all</li>
<li>Haven&#8217;t tested yet.</li>
<li>have not been actively qa&#8217;ing for ie8</li>
<li>Don&#8217;t know</li>
<li>untested</li>
<li>Haven&#8217;t tested yet.</li>
<li>Still checking</li>
<li>Have not checked</li>
<li>not sure</li>
<li>Haven&#8217;t even tested yet</li>
<li>Internal NO, External Yes</li>
<li>testing this week</li>
<li>have no ieda</li>
<li>I&#8217;ve not played with IE 8 much</li>
<li>Maybe</li>
<li>Don&#8217;t know</li>
<li>Don&#8217;t know yet</li>
<li>Haven&#8217;t checked yet ;)</li>
<li>Haven&#8217;t checked.</li>
<li>We haven&#8217;t even started testing yet.</li>
<li>Most of them, yes</li>
<li>for the most part</li>
<li>haven&#8217;t been able to test yet.</li>
<li>Untested&#8230;</li>
<li>Haven&#8217;t tested all yet.</li>
<li>not sure at the moment</li>
<li>Do not know yet.</li>
<li>Not Sure</li>
<li>not sure</li>
<li>I don&#8217;t know</li>
<li>not sure yet.</li>
<li>Haven&#8217;t checked</li>
<li>mostly</li>
<li>Everything renders larger</li>
<li>Haven&#8217;t checked yet</li>
<li>I should say not&#8230;!</li>
<li>the phone&#8217;s not ringing &#8230; yet</li>
<li>Haven&#8217;t tested yet.</li>
<li>have not check them yet.</li>
<li>Most are, using the meta tag for IE7 rendering</li>
<li>Don&#8217;t know. I would imagine most if not all will work.</li>
<li>havn</li>
<li>idk I&#8217;ll begin testing in it now</li>
<li>not sure</li>
<li>The ones I direclyt worked on, yes</li>
<li>haven&#8217;t checked</li>
<li>untested</li>
<li>Mostly, have to fix some float issues.</li>
<li>need to check</li>
<li>there are issues</li>
</ul>
</td>
<td><strong>208</strong></td>
<td></td>
<td></td>
</tr>
</tfoot>
</table>
<div id="defaultChart4" style="width: 600px; height: 200px;margin-bottom:2em;"></div>
<p><script type="text/javascript" src="http://benjaminsterling.com/wp-content/themes/silhouette2/common/js/jquery.gchart.js"></script><br />
<script type="text/javascript" src="http://benjaminsterling.com/wp-content/themes/silhouette2/common/js/iesupportscripts.js"></script></p>
]]></content:encoded>
			<wfw:commentRss>http://benjaminsterling.com/ie6-support/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Developer Tools That Don&#8217;t Get Enough Love</title>
		<link>http://benjaminsterling.com/developer-tools-that-dont-get-enough-love/</link>
		<comments>http://benjaminsterling.com/developer-tools-that-dont-get-enough-love/#comments</comments>
		<pubDate>Mon, 08 Dec 2008 06:00:46 +0000</pubDate>
		<dc:creator>Benjamin Sterling</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[Jing]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[Twitter]]></category>
		<category><![CDATA[Virtualbox]]></category>
		<category><![CDATA[Yugma]]></category>

		<guid isPermaLink="false">http://benjaminsterling.com/?p=127</guid>
		<description><![CDATA[Jing The concept of Jing is the always-ready program that instantly captures and shares images and video…from your computer to anywhere. Why I think this tool should get more love? Ever needed to explain something over the phone to someone and they are just not getting it? So what do you do, you take a [...]]]></description>
			<content:encoded><![CDATA[<p><a href='http://benjaminsterling.com/wp-content/uploads/2008/12/jing.png'><img src="http://benjaminsterling.com/wp-content/uploads/2008/12/jing.png" alt="" title="jing" width="300" height="200" class="alignright size-full wp-image-128 featureImg" /></a></p>
<h3>Jing</h3>
<blockquote><p>The concept of Jing is the always-ready program that instantly captures and shares images and video…from your computer to anywhere.</p></blockquote>
<p>Why I think this tool should get more love?  Ever needed to explain something over the phone to someone and they are just not getting it?  So what do you do, you take a bunch of &#8220;print screens&#8221; and past it into a Word doc and send that over.  They get it and they still don&#8217;t get &#8220;it.&#8221;  Well, this is where jing comes in, you simply open the program &#8211; if you don&#8217;t already have it open be default like me &#8211; select a section of the screen to record, record what you are trying to explain, save and the send that SWF over and you just saved yourself hours of hassle.<br />
<a href="http://www.jingproject.com/" target="_blank">http://www.jingproject.com/</a></p>
<p><a href='http://benjaminsterling.com/wp-content/uploads/2008/12/yugma.png'><img src="http://benjaminsterling.com/wp-content/uploads/2008/12/yugma.png" alt="" title="yugma" width="260" height="65" class="alignright size-full wp-image-129 featureImg" /></a></p>
<h3>Yugma</h3>
<blockquote><p>Yugma is the leader in affordable instant web conferencing solutions. Yugma provides Free, Professional, and Enterprise web conferencing software-as-a-service (SaaS) solutions to individuals, small businesses, and large enterprises across a diverse range of industries.</p></blockquote>
<p>Why I think this tool should get more love? Inline with Jing, using Yugma helps you take client &#8220;support&#8221; to the next level.  Sometimes a three minute video is not enough, you actually need to see what the client is seeing and the next best thing to actually sitting of the clients or co-workers shoulder is to share their screen.  Yugma&#8217;s free account, although not as feature rich as the Pro account, it gets the job done in a pinch.<br />
<a href="http://tinyurl.com/6yt5mo" target="_blank">http://www.yugma.com/</a></p>
<p><a href='http://benjaminsterling.com/wp-content/uploads/2008/12/twitter.jpg'><img src="http://benjaminsterling.com/wp-content/uploads/2008/12/twitter-300x200.jpg" alt="" title="twitter" width="300" height="200" class="alignright size-medium wp-image-130 featureImg" /></a></p>
<h3>Twitter</h3>
<blockquote><p>Twitter is a service for friends, family, and co–workers to communicate and stay connected through the exchange of quick, frequent answers to one simple question: What are you doing?</p></blockquote>
<p>Why I think this tool should get more love? Really, Twitter gets a ton of love from the average person to Steven Colbert to CNN but I don&#8217;t think it gets enough love as tool for Developers/Designers.  Imagine you work is a firm, design/development/both, and you have a problem with some code or how to make a design better, you simply call over one of your co-workers and get their advice.  But if you don&#8217;t work in an office where you can get help you alternatives are forums, mailing groups or IRC which are all ok, but not &#8211; in my experience &#8211; give off the truly &#8220;personal&#8221; help that Twitter can help provide.  If you follow and build a  rapport with other people a request for help can be fulfilled pretty quickly.<br />
<a href="http://twitter.com">http://twitter.com</a> | <a href="http://twitter.com/bmsterling">follow me</a></p>
<p><a href='http://benjaminsterling.com/wp-content/uploads/2008/12/2-empty-vm-created.png'><img src="http://benjaminsterling.com/wp-content/uploads/2008/12/2-empty-vm-created-300x259.png" alt="" title="2-empty-vm-created" width="300" height="259" class="alignright size-medium wp-image-131 featureImg" /></a></p>
<h3>Virtualbox</h3>
<blockquote><p>VirtualBox is a family of powerful x86 virtualization products for enterprise as well as home use. Not only is VirtualBox an extremely feature rich, high performance product for enterprise customers, it is also the only professional solution that is freely available as Open Source Software under the terms of the GNU General Public License (GPL). See &#8220;About VirtualBox&#8221; for an introduction. </p></blockquote>
<p>Why I think this tool should get more love? I&#8217;ve had limited interaction with the other visualization apps but I really must say that I really like VirtualPC.  &#8220;But you are talking about VirtualBox, am I missing something?&#8221;  No, no you are not.  VirtualPC in my mind is probably the best visualization app out there but it costs $$ and if you are not making a ton of $$ the next runner up is VirtualBox which is an extremely close second.  In my development I try to test in as many environments as I can, I try to set up my VB to only have 512mb of ram running WinXp and Win2000 (don&#8217;t have Vista yet otherwise that would be my main install).  The reason for setting up weaker environments then my custom built machine is because not everyone has 3.5gb of ram with a video card that has 512mb ram and so on.  Some of the apps I build are quite JavaScript intense so I need to make sure it can still run as smoothly as possible in those systems.<br />
<a href="http://www.virtualbox.org/">http://www.virtualbox.org/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://benjaminsterling.com/developer-tools-that-dont-get-enough-love/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Really Simple History: Ajax history and bookmarking library</title>
		<link>http://benjaminsterling.com/really-simple-history-ajax-history-and-bookmarking-library/</link>
		<comments>http://benjaminsterling.com/really-simple-history-ajax-history-and-bookmarking-library/#comments</comments>
		<pubDate>Wed, 03 Dec 2008 16:00:51 +0000</pubDate>
		<dc:creator>Benjamin Sterling</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://benjaminsterling.com/?p=119</guid>
		<description><![CDATA[For some time now I have been using Really Simple History for my applications that use a good amount of AJAX. RSH is exactly what it sounds like, it is a really simple way of adding history and bookmarking to your AJAXified apps.  To see it in action have a look at the Mason's Graduate [...]]]></description>
			<content:encoded><![CDATA[<p>For some time now I have been using <a href="http://code.google.com/p/reallysimplehistory/" target="_blank">Really Simple History </a>for my applications that use a good amount of <abbr title="asynchronous JavaScript and XML">AJAX</abbr>.  <abbr title="Really Simple History">RSH</abbr> is exactly what it sounds like, it is a really simple way of adding history and bookmarking to your AJAXified apps.  To see it in action have a look at the <a href="http://admissions.gmu.edu/grad/matrix/" target="_blank">Mason's Graduate Requirements</a> site where it is being used to handle bookmarking for four separate parameters.</p>
<p>What I want to cover in the article is what I have learned and what steps I took when coding with RSH for the Mason project and for some other on going projects.</p>
<p>First thing you should do is download the <a href="http://reallysimplehistory.googlecode.com/files/RSH0.6FINAL.zip" target="_blank">Really Simple History code</a>.</p>
<p>Secondly, I have been using a modified version of <a href="http://adamv.com/dev/javascript/querystring" target="_blank">Adam Vandenberg's Querystring</a> functions which has only one modification to it.</p>
<div class="igBar"><span id="ljavascript-5"><a href="#" onclick="javascript:showPlainTxt('javascript-5'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">JavaScript:</span>
<div id="javascript-5">
<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>qs == <span style="color: #003366; font-weight: bold;">null</span><span style="color: #66cc66;">&#41;</span> qs = location.<span style="color: #006600;">search</span>.<span style="color: #006600;">substring</span><span style="color: #66cc66;">&#40;</span><span style="color: #CC0000;color:#800000;">1</span>, location.<span style="color: #006600;">search</span>.<span style="color: #006600;">length</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: #009900; font-style: italic;">// changed to</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>qs == <span style="color: #003366; font-weight: bold;">null</span><span style="color: #66cc66;">&#41;</span> qs = location.<span style="color: #006600;">hash</span>.<span style="color: #006600;">replace</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066FF;">/^.*#/</span>, <span style="color: #3366CC;">''</span><span style="color: #66cc66;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>You will need to set up your script is a particular way so that the history script is created first, and then initialized, at least the way I do it, when DOM is ready.  You can get away with doing it on Window.onload but since most likely your code will be minipulating the DOM, initializing on DOM ready is probably better for you.</p>
<p>I set up my inital code like below:</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> initail = <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;"><span style="color: #003366; font-weight: bold;">var</span> qs = <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;">window.<span style="color: #006600;">dhtmlHistory</span>.<span style="color: #006600;">create</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;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<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-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;">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-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; dhtmlHistory.<span style="color: #006600;">initialize</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; dhtmlHistory.<span style="color: #006600;">addListener</span><span style="color: #66cc66;">&#40;</span>theListener<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; <span style="color: #000066; font-weight: bold;">if</span><span style="color: #66cc66;">&#40;</span>!initail<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; theListener<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: #66cc66;">&#125;</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>Lines 1 and 2 we set up some globals we will be reusing later on and line 4 we create the history object.  Lines 5 and 6 should be familiar to you, here we just check to see if the DOM is ready, if so, we run the code in the containing function.  Line 8 we initialize the history script and at line 9 we set the listener to "theListener" which is a function I will point out further down the page.  You will see that I also have an IF statement that is checking to see if this is the initial run.  This is because the the RSH script does not run the listener script when it is initialized.</p>
<p>The next function is just a helper function I use all the time when dealing with the hash:</p>
<div class="igBar"><span id="ljavascript-7"><a href="#" onclick="javascript:showPlainTxt('javascript-7'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">JavaScript:</span>
<div id="javascript-7">
<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;">hash = <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; <span style="color: #000066; font-weight: bold;">return</span> location.<span style="color: #006600;">hash</span>.<span style="color: #006600;">replace</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066FF;">/^.*#/</span>, <span style="color: #3366CC;">''</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>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>The last function is the "theListener" function which I referenced at line 9 of the second group of codes.  This function will get called each and every time the hash changes.</p>
<div class="igBar"><span id="ljavascript-8"><a href="#" onclick="javascript:showPlainTxt('javascript-8'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">JavaScript:</span>
<div id="javascript-8">
<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;">theListener = <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; <span style="color: #000066; font-weight: bold;">if</span><span style="color: #66cc66;">&#40;</span>!initail<span style="color: #66cc66;">&#41;</span> initail = <span style="color: #003366; font-weight: bold;">true</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; qs = <span style="color: #003366; font-weight: bold;">new</span> Querystring<span style="color: #66cc66;">&#40;</span> hash<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</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; <span style="color: #000066; font-weight: bold;">if</span><span style="color: #66cc66;">&#40;</span> <span style="color: #000066; font-weight: bold;">typeof</span> qs.<span style="color: #006600;">get</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'cat'</span><span style="color: #66cc66;">&#41;</span> == <span style="color: #3366CC;">'undefined'</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: #009900; font-style: italic;">// run cat specific code</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></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>
</ol>
</div>
</div>
</div>
<p></p>
<p>Although the RSH script does pass back two params you will see that I don't use them and the only real reason for this is that I felt it was too complicated and I never really figured out how I should use them.</p>
<p>At line 2 of the function we check to see if the function was already initiated.  Then at line 3 we set up a new Querystring reference - should probably change the name to hashstring or something like that at some point.  And from this point on, you can check your query string for what ever parameters you need to and run the appropriate codes.</p>
]]></content:encoded>
			<wfw:commentRss>http://benjaminsterling.com/really-simple-history-ajax-history-and-bookmarking-library/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Web Tech November Meetup Presentation</title>
		<link>http://benjaminsterling.com/web-tech-november-meetup-presentation/</link>
		<comments>http://benjaminsterling.com/web-tech-november-meetup-presentation/#comments</comments>
		<pubDate>Tue, 25 Nov 2008 17:35:00 +0000</pubDate>
		<dc:creator>Benjamin Sterling</dc:creator>
				<category><![CDATA[jQuery]]></category>
		<category><![CDATA[Presentations]]></category>
		<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://benjaminsterling.com/?p=116</guid>
		<description><![CDATA[Last night I had the opportunity to speak at the Web Tech November Meetup in Baltimore about jQuery.  I focused mainly on traversing since I believe once you fully grasp some of the built in jQuery traversing methods you can do just about anything using jQuery and do it easily. Preparations I spent about three [...]]]></description>
			<content:encoded><![CDATA[<p>Last night I had the opportunity to speak at the <em>Web Tech November Meetup </em>in Baltimore about jQuery.  I focused mainly on <em>traversing</em> since I believe once you fully grasp some of the built in jQuery traversing methods you can do just about anything using jQuery and do it easily.</p>
<h3>Preparations</h3>
<p>I spent about three weeks getting this presentation together with the hopes that everything I talked about would be self-explanatory.  For the most part it was, there was some items that I should have wrote differently as to not make it look complicated.  Over all I think most of the items just flowed well.</p>
<p>My preparations went something like this, first I went through most of the code I had written over the past two months.  As I went through the code I made a tally of what traversing methods where used and how often.  I was suprise to see that I used <em>.eq() </em>quite often, guess I am glad jQuery brought that back quickly after the move to the <em>.slice()</em> method back at <em>1.1.4</em>.  The others that ranked pretty high were <em>.is(), .hasClass()</em> and <em>.not()</em>.</p>
<p>Since that list is pretty small I decided to go through some of the "help" emails, IMs and twitter messages I have gotten over the past couple of months and although I took some more complex routes with the answers I provided, after looking at them again they could have been accomplished better by using some of the family methods.  Yes, I am coining a new phrase for a group of methods.  Those methods are <em>.children()</em>, <em>.parent()</em>, <em>.parents()</em>, <em>.siblings()</em>, and the cousins <em>.next()</em> and <em>.prev()</em>.  I also through in <em>.end()</em> since this can be a very useful method and helps the chaining a bunch of calls together.</p>
<p>I know that I am much better presentor when i present on the fly with minimum talking points, so actually creating a slideshow and talking off of that slide show was going to very hard for me.  After many, many edits to my talking points that I had written down and desided to put pen to paper or mouse pointer to web browser.  I signed up for an account with <a href="http://280slides.com/" target="_blank">280slides</a>, started making my slide.  Although the app does not offer the same flexiblity or features that a desktop app would provide, it was pretty damned close.  My hat goes off to the developers of that app, it is quite nice.</p>
<p>After some time, about two weeks, I finally got the presentation done the day before I was to present.  I went to the slides over and over again and noted what points I should make what points were less important and depending on how well the presentation was going, I would expand on those talking points.</p>
<h3>The Presentation</h3>
<p>The meetup did not have a big turn out so the nervousness I had before hand disapated enough for me to get in to my zone.  I started off by introducing myself and did my best to keep away from any self depricating statements that I am so very skilled at.  Told the group what I would be focusing on, Selecting, Caching, Traversing, and we were on our way.</p>
<p>The group consisted of a few JavaScript rookies and JavaScript novices but for the most part, everyone knew CSS.  So for selectors, I focused on if you know CSS then you know how to select DOM elements in jQuery.  It really is that simple.  I explained the <em>Hierarchy Selectors</em> since a good majority of people I've helped over the years don't fully grasp them.  The main ones are the <em>prev + next</em> and <em>prev ~ siblings</em> selectors since if you don't see it is use, you can't really grasp the purpose of them.  I also showed the built in <em>Custom Selectors</em> but did not go into detail with them.</p>
<p>Caching was pretty straight forward so there was not much explanation needed for that.</p>
<p>Finally I jumped in to Traversing, focusing the methods I mentioned above.  The  <em>.is(), .hasClass()</em> and <em>.not()</em> methods were pretty easy to explain, but for the family methods I actually had to show a family, my family.  I created a family tree for the group to better demonstrate  <em>.children()</em>, <em>.parent()</em>, <em>.parents()</em>, <em>.siblings()</em>.  I think it went over pretty well, I think for ease, I will put this grab in between each of the family method slides.  Moving back and forth between slides was a bit time consuming.</p>
<p>Explaining the <em>.next()</em> and <em>.prev()</em> methods was pretty easy and straight forward, there were some questions, but mainly because I was using a bad term, can't remember what it was now.</p>
<p>To demonstrate .end(), I pulled up a few pieces of code from projects that I've been working on and explained what each line was doing, much like what I did for the "<a href="http://benjaminsterling.com/slide-in-tab-window-using-jquery/">Slide in tab</a>" post I did a few weeks back.</p>
<h3>The Close</h3>
<p>There really was not a ton of questions thrown my way, that could mean that I did an excellent job of explaining myself or it means people were totally confused and felt I could not help them.   For the questions that were asked, I was able to answer them pretty easily.</p>
<h3>My thoughts</h3>
<p>There are obviously a few things I feel I need to work on and will try to do so.  I want to do some more talks, maybe focusing on the same topic at first till I feel that one is working the way I want and then maybe move on to more complicated jQuery topics.</p>
<p>The slide show I used for my presentation is below, feel free to have a look at it and let me know your thoughts.  <del datetime="2008-11-25T17:46:47+00:00">As soon as slideshare is done processing it I will post the slideshare link here, till then feel free to check out the presentation via 280slides.</del></p>
<h3>The Slides</h3>
<p><object style="margin:0px" width="425" height="355"><param name="movie" value="http://static.slideshare.net/swf/ssplayer2.swf?doc=gettingyourfeetwetwithjquery2-1227634332338868-8&#038;stripped_title=getting-your-feet-wet-with-jquery2-presentation" /><param name="allowFullScreen" value="true"/><param name="allowScriptAccess" value="always"/><embed src="http://static.slideshare.net/swf/ssplayer2.swf?doc=gettingyourfeetwetwithjquery2-1227634332338868-8&#038;stripped_title=getting-your-feet-wet-with-jquery2-presentation" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="355"></embed></object></p>
]]></content:encoded>
			<wfw:commentRss>http://benjaminsterling.com/web-tech-november-meetup-presentation/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Slide in tab window using jQuery</title>
		<link>http://benjaminsterling.com/slide-in-tab-window-using-jquery/</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[jQuery]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Web Development]]></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-12"><a href="#" onclick="javascript:showPlainTxt('javascript-12'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">JavaScript:</span>
<div id="javascript-12">
<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-13"><a href="#" onclick="javascript:showPlainTxt('css-13'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CSS:</span>
<div id="css-13">
<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-14"><a href="#" onclick="javascript:showPlainTxt('javascript-14'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">JavaScript:</span>
<div id="javascript-14">
<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>
]]></content:encoded>
			<wfw:commentRss>http://benjaminsterling.com/slide-in-tab-window-using-jquery/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Better jQuery Code #2</title>
		<link>http://benjaminsterling.com/better-jquery-code-2/</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[jQuery]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[Web Development]]></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 [...]]]></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-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;">'#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-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;">'#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-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;">&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-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: #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-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;">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-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: #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-31"><a href="#" onclick="javascript:showPlainTxt('javascript-31'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">JavaScript:</span>
<div id="javascript-31">
<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-32"><a href="#" onclick="javascript:showPlainTxt('javascript-32'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">JavaScript:</span>
<div id="javascript-32">
<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-33"><a href="#" onclick="javascript:showPlainTxt('javascript-33'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">JavaScript:</span>
<div id="javascript-33">
<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-34"><a href="#" onclick="javascript:showPlainTxt('javascript-34'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">JavaScript:</span>
<div id="javascript-34">
<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>
]]></content:encoded>
			<wfw:commentRss>http://benjaminsterling.com/better-jquery-code-2/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Better jQuery Code #1</title>
		<link>http://benjaminsterling.com/better-jquery-code-1/</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[jQuery]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[Web Development]]></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-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;"><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-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;"><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-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;"><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-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;">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-47"><a href="#" onclick="javascript:showPlainTxt('javascript-47'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">JavaScript:</span>
<div id="javascript-47">
<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-48"><a href="#" onclick="javascript:showPlainTxt('javascript-48'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">JavaScript:</span>
<div id="javascript-48">
<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-49"><a href="#" onclick="javascript:showPlainTxt('javascript-49'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">JavaScript:</span>
<div id="javascript-49">
<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-50"><a href="#" onclick="javascript:showPlainTxt('javascript-50'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">JavaScript:</span>
<div id="javascript-50">
<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>
]]></content:encoded>
			<wfw:commentRss>http://benjaminsterling.com/better-jquery-code-1/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Things I&#8217;ve Learned While building a WordPress Plugin</title>
		<link>http://benjaminsterling.com/things-ive-learned-while-building-a-wordpress-plugin/</link>
		<comments>http://benjaminsterling.com/things-ive-learned-while-building-a-wordpress-plugin/#comments</comments>
		<pubDate>Sat, 15 Mar 2008 03:47:52 +0000</pubDate>
		<dc:creator>Benjamin Sterling</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Plugin]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://benjaminsterling.com/things-ive-learned-while-building-a-wordpress-plugin/</guid>
		<description><![CDATA[<img src="wp-content/themes/sterling/common/img/icon_wordpress.jpg" class="excerptImg"/>After building my first few WordPress plugins I learned quite a few things that I just could not find good information on.  So what I will be doing over a couple or so posts is explaining what the problem/issue was that I had and show you how I went about resolving the problem/issue.]]></description>
			<content:encoded><![CDATA[<div class='series_toc'><h3>Table of contents for What I learned while building a WordPress Plugin</h3><ol><li>Things I&#8217;ve Learned While building a WordPress Plugin</li></ol></div> <p>After building my first few WordPress plugins I learned quite a few things that I just could not find good information on.  So what I will be doing over a couple or so posts is explaining what the problem/issue was that I had and show you how I went about resolving the problem/issue.</p>
<h4>How do I add a sub menu for my plugins admin and what is a "unique identifier"?</h4>
<p>Ok, creating a submenu is not very hard and <a href="http://codex.wordpress.org/Adding_Administration_Menus#Sub-Menus" rel="nofollow">WordPress docs</a> does an ok job of explaining it.  But when you are building your plugin using a class structure it is not very clear what you should do.</p>
<p>Lets assume that you have a class called "myClass" and a function with in it that is called "adminMenu."  Let's also assume that this class is also on the same file that is your main plugin file that has the version information on it. Your typical php4 based class would look like (php5 based classes have __construct instead of calling myClass and some other minor differences):</p>
<div class="igBar"><span id="lphp-51"><a href="#" onclick="javascript:showPlainTxt('php-51'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-51">
<div class="php">
<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:#000000; font-weight:bold;">class</span> myClass<span style="color:#006600; font-weight:bold;">&#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;">function</span> myClass<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#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; add_action<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'admin_menu'</span>, <a href="http://www.php.net/array"><span style="color:#000066;">array</span></a><span style="color:#006600; font-weight:bold;">&#40;</span>&amp;amp;<span style="color:#0000FF;">$this</span>, <span style="color:#FF0000;">'adminMenu'</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#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; font-weight:bold;">&#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; </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;">function</span> adminMenu<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#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:#616100;">if</span> <span style="color:#006600; font-weight:bold;">&#40;</span><a href="http://www.php.net/function_exists"><span style="color:#000066;">function_exists</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'add_menu_page'</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#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; add_menu_page<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'My Class'</span>,<span style="color:#FF0000;">'My Class'</span>, <span style="color:#CC66CC;color:#800000;">7</span>, <span style="color:#000000; font-weight:bold;">__FILE__</span>, <a href="http://www.php.net/array"><span style="color:#000066;">array</span></a><span style="color:#006600; font-weight:bold;">&#40;</span>&amp;<span style="color:#0000FF;">$this</span>, <span style="color:#FF0000;">'adminSubPage1'</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#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; font-weight:bold;">&#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; <span style="color:#616100;">if</span> <span style="color:#006600; font-weight:bold;">&#40;</span><a href="http://www.php.net/function_exists"><span style="color:#000066;">function_exists</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'add_submenu_page'</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#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; add_submenu_page<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#000000; font-weight:bold;">__FILE__</span>, <span style="color:#FF0000;">'SubMenu 1'</span>, <span style="color:#FF0000;">'SubMenu 1'</span>, <span style="color:#CC66CC;color:#800000;">7</span>, <span style="color:#000000; font-weight:bold;">__FILE__</span>, <a href="http://www.php.net/array"><span style="color:#000066;">array</span></a><span style="color:#006600; font-weight:bold;">&#40;</span>&amp;<span style="color:#0000FF;">$this</span>, <span style="color:#FF0000;">'adminSubPage1'</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#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; add_submenu_page<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#000000; font-weight:bold;">__FILE__</span>, <span style="color:#FF0000;">'SubMenu 2'</span>, <span style="color:#FF0000;">'SubMenu 2'</span>, <span style="color:#CC66CC;color:#800000;">7</span>, <span style="color:#FF0000;">'mc_adminSubPage2'</span>, <a href="http://www.php.net/array"><span style="color:#000066;">array</span></a><span style="color:#006600; font-weight:bold;">&#40;</span>&amp;<span style="color:#0000FF;">$this</span>, <span style="color:#FF0000;">'adminSubPage2'</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#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; font-weight:bold;">&#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:#006600; font-weight:bold;">&#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:#006600; font-weight:bold;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>At line three we add an action that points to the "adminMenu" function and let me clarify what I have found happens with "array(&amp;$this, 'adminMenu')".  WordPress will take "array(&amp;$this, 'adminMenu')" and make it into myClass::adminMenu() and execute it like that - the <font color="#ff0000">&amp;this</font> is a reference to <font color="#ff0000">myClass.</font></p>
<p>At line 8 we have the main link that gets put at the top next to "Plugins," "Comments" and so on.  You will notice the <font color="#ff0000">__FILE__</font> constant, this allows WordPress to set that menu item to reference the plugins main file.   You also see <font color="#ff0000">array(&amp;$this, 'adminSubPage1') </font>will execute as <font color="#ff0000">myClass::adminSubPage1()</font> (this function is not shown).</p>
<p>At line 11 we create our first submenu for our plugin which also points to the  <font color="#ff0000">adminSubPage1</font> function, which is needed I found.  If you don't have a submenu item that points to the same "page" as the main menu item, the submenu items will not show up.</p>
<p>At line 12 we create our second submenu item that points to the  <font color="#ff0000">adminSubPage2</font> function (also not shown).    You will notice a three differences between the two submenus, two being the Names and the function they point to, and the third is the <font color="#ff0000">mc_adminSubPage2 </font>which is our <font color="#ff0000">unique identifier</font>.  This will give us a url the looks something like <font color="#ff0000">admin.php?page=mc_adminSubPage2</font>.</p>
<p>Nothing real fancy with this one, just wanted show how to create your plugin menu items while using a Object Oriented approach.  Feel free to let me know if there is an easier way or if I am all around incorrect.  Next post will be about loading of jQuery and your other JavaScript without messing up the Prototype code that WordPress and other WP plugins use.</p>
 <div class='series_links'> </div>]]></content:encoded>
			<wfw:commentRss>http://benjaminsterling.com/things-ive-learned-while-building-a-wordpress-plugin/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jQuery: Select what you want &#8211; part 2</title>
		<link>http://benjaminsterling.com/jquery-select-what-you-want-part-2/</link>
		<comments>http://benjaminsterling.com/jquery-select-what-you-want-part-2/#comments</comments>
		<pubDate>Tue, 27 Nov 2007 03:28:47 +0000</pubDate>
		<dc:creator>Benjamin Sterling</dc:creator>
				<category><![CDATA[jQuery]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[selectors]]></category>

		<guid isPermaLink="false">http://benjaminsterling.com/2007/11/26/jquery-select-what-you-want-part-2/</guid>
		<description><![CDATA[In my first post about jQuery Selectors call Select what you want, I went over some basic selectors that I use on a daily basis within a web based training framework I put together using jQuery. What I would like to cover are some of the situations I have ran into over the past year [...]]]></description>
			<content:encoded><![CDATA[<div class='series_toc'><h3>Table of contents for Select anything</h3><ol><li><a href='http://benjaminsterling.com/jquery-select-what-you-want-part-1/' title='jQuery: Select what you want &#8211; part 1'>jQuery: Select what you want &#8211; part 1</a></li><li>jQuery: Select what you want &#8211; part 2</li></ol></div> <p>In my first post about jQuery Selectors call <a href="http://benjaminsterling.com/2007/11/25/jquery-select-what-you-want-part-1/">Select what you want</a>, I went over some basic selectors that I use on a daily basis within a web based training framework I put together using jQuery.  What I would like to cover are some of the situations I have ran into over the past year while using jQuery are my frameworks backbone.</p>
<p>Some of the selections we will cover are searching for links with an specific extension, images, images that wrapped in a link, links and definition lists.</p>
<p>Let me give you some background on the process.  We have a content writer who supplies us with with a storyboard for the content and flow.  We then create a separate Html page for each page within that storyboard.  Each one of these pages is brought into the main page using the .load method for jQuery.  All the selections are being done in the callback of the .load method, like:</p>
<div class="igBar"><span id="ljavascript-66"><a href="#" onclick="javascript:showPlainTxt('javascript-66'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">JavaScript:</span>
<div id="javascript-66">
<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;">".textArea"</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">empty</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">load</span><span style="color: #66cc66;">&#40;</span>URL, <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; <span style="color: #009900; font-style: italic;">// selection calls</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></p>
<p>The following will be the functional request that the writer asks for.  Note the "<strong>this</strong>" in my selector calls is referring to <strong>textArea</strong>.  Also note that these will not be optimized calls, for instance, if I were going to check for images or links multiple times for different things, I would do something like:</p>
<div class="igBar"><span id="ljavascript-67"><a href="#" onclick="javascript:showPlainTxt('javascript-67'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">JavaScript:</span>
<div id="javascript-67">
<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> $img = $<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">"img"</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;"><span style="color: #003366; font-weight: bold;">var</span> $a = $<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">"a"</span>, <span style="color: #000066; font-weight: bold;">this</span><span style="color: #66cc66;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>But for the purpose of this post, I will code as if there is only one thing we are looking for and most of these will be very simple selections.</p>
<p>Functional request:  Have smaller image open a bigger image in a jqModal box</p>
<h5>The Html</h5>
<div class="igBar"><span id="lhtml-68"><a href="#" onclick="javascript:showPlainTxt('html-68'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">HTML:</span>
<div id="html-68">
<div class="html">
<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;"><a href="http://december.com/html/4/element/a.html"><span style="color: #000000; font-weight: bold;">&lt;a</span></a> <span style="color: #000066;">href</span>=<span style="color: #ff0000;">"path/to/big"</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">"jqModal"</span><span style="color: #000000; font-weight: bold;">&gt;</span></a></span><span style="color: #009900;"><a href="http://december.com/html/4/element/img.html"><span style="color: #000000; font-weight: bold;">&lt;img</span></a> <span style="color: #000066;">src</span>=<span style="color: #ff0000;">"path/to/small"</span>/<span style="color: #000000; font-weight: bold;">&gt;</span></a></span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/a&gt;</span></span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<h5>The JavaScript</h5>
<div class="igBar"><span id="ljavascript-69"><a href="#" onclick="javascript:showPlainTxt('javascript-69'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">JavaScript:</span>
<div id="javascript-69">
<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;">"a.jqModal:has( img )"</span>, <span style="color: #000066; font-weight: bold;">this</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></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: #009900; font-style: italic;">// jqModal code</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></p>
<p>Functional request:  Have a "how-to" open in a jqModal iframed box</p>
<h5>The Html</h5>
<div class="igBar"><span id="lhtml-70"><a href="#" onclick="javascript:showPlainTxt('html-70'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">HTML:</span>
<div id="html-70">
<div class="html">
<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;"><a href="http://december.com/html/4/element/a.html"><span style="color: #000000; font-weight: bold;">&lt;a</span></a> <span style="color: #000066;">href</span>=<span style="color: #ff0000;">"path/to/howto"</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">"jqModalFramed"</span><span style="color: #000000; font-weight: bold;">&gt;</span></a></span>How to link text<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/a&gt;</span></span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<h5>The JavaScript</h5>
<div class="igBar"><span id="ljavascript-71"><a href="#" onclick="javascript:showPlainTxt('javascript-71'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">JavaScript:</span>
<div id="javascript-71">
<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;">"a.jqModalFramed"</span>, <span style="color: #000066; font-weight: bold;">this</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></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: #009900; font-style: italic;">// jqModal code</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></p>
<p>Functional request:  Have pdfs alert before opening</p>
<h5>The Html</h5>
<div class="igBar"><span id="lhtml-72"><a href="#" onclick="javascript:showPlainTxt('html-72'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">HTML:</span>
<div id="html-72">
<div class="html">
<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;"><a href="http://december.com/html/4/element/a.html"><span style="color: #000000; font-weight: bold;">&lt;a</span></a> <span style="color: #000066;">href</span>=<span style="color: #ff0000;">"thePdf.pdf"</span><span style="color: #000000; font-weight: bold;">&gt;</span></a></span>View PDF<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/a&gt;</span></span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<h5>The JavaScript</h5>
<div class="igBar"><span id="ljavascript-73"><a href="#" onclick="javascript:showPlainTxt('javascript-73'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">JavaScript:</span>
<div id="javascript-73">
<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;">"a[href$='.pdf'"</span>, <span style="color: #000066; font-weight: bold;">this</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></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: #009900; font-style: italic;">// prompt box code</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></p>
<p>Functional request:  Have glossary of words and when those words a clicked, show it's definition</p>
<h5>The Html</h5>
<div class="igBar"><span id="lhtml-74"><a href="#" onclick="javascript:showPlainTxt('html-74'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">HTML:</span>
<div id="html-74">
<div class="html">
<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;"><a href="http://december.com/html/4/element/dl.html"><span style="color: #000000; font-weight: bold;">&lt;dl&gt;</span></a></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: #009900;"><a href="http://december.com/html/4/element/dt.html"><span style="color: #000000; font-weight: bold;">&lt;dt&gt;</span></a></span>Word<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/dt&gt;</span></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: #009900;"><a href="http://december.com/html/4/element/dd.html"><span style="color: #000000; font-weight: bold;">&lt;dd&gt;</span></a></span>Definition<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/dd&gt;</span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/dl&gt;</span></span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<h5>The JavaScript</h5>
<div class="igBar"><span id="ljavascript-75"><a href="#" onclick="javascript:showPlainTxt('javascript-75'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">JavaScript:</span>
<div id="javascript-75">
<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;">'dl'</span>, <span style="color: #000066; font-weight: bold;">this</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">find</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'DT'</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;">toggle</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: #000066; font-weight: bold;">this</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">addClass</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'open'</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">removeClass</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'closed'</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">nextUntil</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'DT'</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>;</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: #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: #000066; font-weight: bold;">this</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">removeClass</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'open'</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>.<span style="color: #006600;">nextUntil</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'DT'</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;"><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: #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;">.<span style="color: #006600;">nextUntil</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'DT'</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;">hide</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Functional request:  Have have a group of radio buttons and when clicked, have them show a response</p>
<h5>The Html</h5>
<div class="igBar"><span id="lhtml-76"><a href="#" onclick="javascript:showPlainTxt('html-76'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">HTML:</span>
<div id="html-76">
<div class="html">
<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;"><a href="http://december.com/html/4/element/input.html"><span style="color: #000000; font-weight: bold;">&lt;input</span></a> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">"radio"</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">"answer1"</span>/<span style="color: #000000; font-weight: bold;">&gt;</span></a></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><a href="http://december.com/html/4/element/p.html"><span style="color: #000000; font-weight: bold;">&lt;p</span></a> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">"answer answer1"</span><span style="color: #000000; font-weight: bold;">&gt;</span></a></span>Text<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/p&gt;</span></span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<h5>The JavaScript</h5>
<div class="igBar"><span id="ljavascript-77"><a href="#" onclick="javascript:showPlainTxt('javascript-77'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">JavaScript:</span>
<div id="javascript-77">
<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;">"input[type=radio]"</span>,<span style="color: #000066; font-weight: bold;">this</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></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;">&#40;</span><span style="color: #3366CC;">'.answer'</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>;&nbsp; <span style="color: #009900; font-style: italic;">// these are p tags that contain the answers</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: #003366; font-weight: bold;">var</span> current = $<span style="color: #66cc66;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">attr</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'name'</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;">&#40;</span><span style="color: #3366CC;">'.'</span>+current<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;">highlightFade</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'yellow'</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></p>
<p>Functional request:  Have external links prompt that they are going outside of site</p>
<h5>The Html</h5>
<div class="igBar"><span id="lhtml-78"><a href="#" onclick="javascript:showPlainTxt('html-78'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">HTML:</span>
<div id="html-78">
<div class="html">
<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;"><a href="http://december.com/html/4/element/a.html"><span style="color: #000000; font-weight: bold;">&lt;a</span></a> <span style="color: #000066;">href</span>=<span style="color: #ff0000;">"epa.gov/radiation/"</span><span style="color: #000000; font-weight: bold;">&gt;</span></a></span>View PDF<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/a&gt;</span></span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<h5>The JavaScript</h5>
<div class="igBar"><span id="ljavascript-79"><a href="#" onclick="javascript:showPlainTxt('javascript-79'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">JavaScript:</span>
<div id="javascript-79">
<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;">"a"</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">filter</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: #000066; font-weight: bold;">return</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #006600;">href</span>.<span style="color: #006600;">match</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066FF;">/.<span style="color: #006600;">com</span>|.<span style="color: #006600;">gov</span>|.<span style="color: #006600;">edu</span>/</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>.<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; <span style="color: #009900; font-style: italic;">// prompt box code</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></p>
<h5>The Final Word</h5>
<p>Each project comes with different requirements; the requirements above were only a small part of the requirements for the most recent project but the rest of the list was pretty simple stuff.  Feel free to post question or corrections.</p>
 <div class='series_links'><a href='http://benjaminsterling.com/jquery-select-what-you-want-part-1/' title='jQuery: Select what you want &#8211; part 1'>Previous in series</a> </div>]]></content:encoded>
			<wfw:commentRss>http://benjaminsterling.com/jquery-select-what-you-want-part-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jQuery: Select what you want &#8211; part 1</title>
		<link>http://benjaminsterling.com/jquery-select-what-you-want-part-1/</link>
		<comments>http://benjaminsterling.com/jquery-select-what-you-want-part-1/#comments</comments>
		<pubDate>Mon, 26 Nov 2007 03:12:46 +0000</pubDate>
		<dc:creator>Benjamin Sterling</dc:creator>
				<category><![CDATA[jQuery]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[selectors]]></category>

		<guid isPermaLink="false">http://benjaminsterling.com/2007/11/25/jquery-select-what-you-want-part-1/</guid>
		<description><![CDATA[In an earlier post I wrote about what are the fastest basic selectors and found out some interesting stuff with regards to speed for some basic selectors. In this post I am going to go over some not-so-basic selectors. I am going to try not to repeat what Karl has said in his two posts, [...]]]></description>
			<content:encoded><![CDATA[<div class='series_toc'><h3>Table of contents for Select anything</h3><ol><li>jQuery: Select what you want &#8211; part 1</li><li><a href='http://benjaminsterling.com/jquery-select-what-you-want-part-2/' title='jQuery: Select what you want &#8211; part 2'>jQuery: Select what you want &#8211; part 2</a></li></ol></div> <p>In an earlier post I wrote about <a href="http://benjaminsterling.com/2007/11/23/jquery-what-are-the-fastest-selector/">what are the fastest basic selectors</a> and found out some interesting stuff with regards to speed for some basic selectors.  In this post I am going to go over some not-so-basic selectors.  I am going to try not to repeat what Karl has said in his two posts, "<a href="http://www.learningjquery.com/2006/11/how-to-get-anything-you-want-part-1">How to Get Anything You Want - part 1</a>" and "<a href="http://www.learningjquery.com/2006/12/how-to-get-anything-you-want-part-2">How to Get Anything You Want - part 2</a>", but some may be worth repeating.</p>
<p>To keep my searches confined to a certain div with a class of "theDiv" using calls like:</p>
<div class="igBar"><span id="ljavascript-81"><a href="#" onclick="javascript:showPlainTxt('javascript-81'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">JavaScript:</span>
<div id="javascript-81">
<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;">"SELECTOR"</span>, <span style="color: #3366CC;">".theDiv"</span><span style="color: #66cc66;">&#41;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Basically what this does is searches for the element with the class of "theDiv" and then searches for "SELECTOR" within that result.</p>
<div class="theDiv" style="border:1px solid #ccc;padding:5px;background:#eaeaea;color:#000">
<table cellpadding="3" cellspacing="0" border="1" width="100%">
<tbody>
<tr>
<td>Cell 1</td>
<td>Cell 2</td>
<td>Cell 3</td>
<td>Cell 4</td>
<td></td>
<td>Cell 6</td>
</tr>
</tbody>
</table>
<p>See the quick brown fox jump <span>over</span> the lazy dog.</p>
<ul>
<li>This is 1</li>
<li>This is 2</li>
<li>3 this is</li>
<li></li>
<li>This is 4</li>
<li>This is 5</li>
</ul>
<input type="button" name="submit" value="Submit button"/>
<input type="submit" name="submit" value="Submit button"/>
<input type="text" name="getMe" value="Not Empty"/>
<input type="text" id="noValue" name="getMe" value=""/>
<input type="text" id="noName" name="" value="No Name Attribute"/>
<div style="display:none;">I am set as display:none</div>
<div style="visibility:hidden;">I am set as visibility:hidden</div>
</p></div>
<h6>We are are going to start off with some "Attribute Filters"</h6>
<p>
<input type="submit" name="test1" value="Test 1 toggle"/> $("[name]") Gets each element with an attribute of "name".  Note that the last	text field did not get highlighted, although it does have an attribute "name" , it is empty, so therefore not selected.</p>
<p>
<input type="submit" name="test2" value="Test 2 toggle"/> $("input[name]") Is the same as above, except we are limiting the return to inputs and if you run each with firebug running on "Profile," this one takes more calls to find the correct element(s).</p>
<p>
<input type="submit" name="test3" value="Test 3 toggle"/> $("[name=getMe]") This one is only grabbing the elements that have the "name" attribute with a value of "getMe"</p>
<p>
<input type="submit" name="test4" value="Test 4 toggle"/> $("[name!=getMe]") This one is only grabbing the elements that <strong>don't</strong> have the "name" attribute with a value of "getMe" and as you can see it even grabbed the elements that did not have the "name" attribute at all.</p>
<p>
<input type="submit" name="test5" value="Test 5 toggle"/> $("[type^=b]") This one matches elements that have the "type" attribute and the value of the "type" attribute starts with a "b".  (in my test area the one submit button has a type of button)</p>
<p>
<input type="submit" name="test6" value="Test 6 toggle"/> $("[type$=t]") This one gets all the elements that has the "type" attribute and it's value ends with "t."</p>
<p>
<input type="submit" name="test7" value="Test 7 toggle"/> $("[value*=no]") This one will match all elements with "no" in it.</p>
<p>
<input type="submit" name="test8" value="Test 8 toggle"/> $("[id*=no]")  Same as "Test 7" except we are grabbing all elements with "no" in the ID </p>
<p>
<input type="submit" name="test9" value="Test 9 toggle"/> $("[id*=no][name=getMe]")</p>
<h6>Wow, that was fun, what did we learn?  You can select anything you want by attribute alone.  Let's get into some "Content Filters"</h6>
<p>
<input type="submit" name="test10" value="Test 10 toggle"/> $(":contains('Cell')") Here we are getting all element with the word "Cell" in it and since we did not filter out what element we wanted, the TABLE, TBODY, TR, and the TD all got selected because they all contained the word "Cell". Note my earlier comment that I am using $(&quot;:contains('Cell')&quot;, &quot;.theDiv&quot;) in my javascript to limit the return results to the containing div, otherwise the BODY and HTML tag and the other elements between BODY and the items with the &quot;Cell&quot; text. </p>
<p>
<input type="submit" name="test11" value="Test 11 toggle"/> $("td:contains('Cell')") Here is the same approach but we will be restricting our search to just the TD.</p>
<p>
<input type="submit" name="test12" value="Test 12 toggle"/> $(":empty") Selects every element that is empty.  If you don't limit your search to items that are <strong>not</strong> form elements, you will get the input fields.</p>
<p>
<input type="submit" name="test13" value="Test 13 toggle"/> $(":has(span)") Selects all elements that <strong>has</strong> a span in it</p>
<p>
<input type="submit" name="test14" value="Test 14 toggle"/> $(":parent") Selects all elements that are "parent" elements</p>
<h6>Oh; you want to be able to get hidden elements?  Visible elements?</h6>
<p>
<input type="submit" name="test15" value="Test 15 toggle"/> $(":hidden") Selects all elements that are hidden, this includes items with a style of display:none or visibility:hidden and input elements with a type of &quot;hidden.&quot; </p>
<p>
<input type="submit" name="test16" value="Test 16 toggle"/> $(":visible") Selects all elements that are visible. </p>
<h6>Where do we go from here</h6>
<p>If you have visited the <a href="http://docs.jquery.com/Selectors" title="jQuery Documentation on Selectors" target="_blank">jQuery Documentation on Selectors</a> you will see that I have not gone over anything new, just maybe rephrased it in "my terms."  These, for the most part, are the selectors I would use on a daily basis, so I felt that these were the best place to start.  Some approaches my be faster, so I would suggest that you take some "me" time and see which ones will work the best in your situation.</p>
<p>In a future alticle, I am going to cover some of the approaches I take with a web base training framework that I think will benifit you</p>
 <div class='series_links'> <a href='http://benjaminsterling.com/jquery-select-what-you-want-part-2/' title='jQuery: Select what you want &#8211; part 2'>Next in series</a></div>]]></content:encoded>
			<wfw:commentRss>http://benjaminsterling.com/jquery-select-what-you-want-part-1/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>jQuery: what are the fastest selectors?</title>
		<link>http://benjaminsterling.com/jquery-what-are-the-fastest-selector/</link>
		<comments>http://benjaminsterling.com/jquery-what-are-the-fastest-selector/#comments</comments>
		<pubDate>Fri, 23 Nov 2007 20:40:21 +0000</pubDate>
		<dc:creator>Benjamin Sterling</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[selectors]]></category>

		<guid isPermaLink="false">http://benjaminsterling.com/2007/11/23/jquery-what-are-the-fastest-selector/</guid>
		<description><![CDATA[Update 12/07/2007: per Brian Cherne comments, I decided to run these test again in Firefox with firebug lite instead of firebug and the execution times were dreastically different. So, to "level the playing field" I would suggest that you turn off firebug or disable it for the page and refresh, you will get the firebug [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Update 12/07/2007:</strong> per <a href="#comment-319">Brian Cherne comments</a>, I decided to run these test again in Firefox with firebug lite instead of firebug and the execution times were dreastically different.  So, to "level the playing field" I would suggest that you turn off firebug or disable it for the page and refresh, you will get the firebug lite console pop up at the bottom of the screen and then run the test.  You will get much better results; but I most ask this question, because after searching I could not find the answer, why the difference in speeds?</p>
<p>I've been using jQuery for over a year now and have built some pretty big apps with it as my "selector" engine and had always wondered what were the fastest ways to select an element.  After reading a post on the mailing list I decided to put some selectors to test.  First thing I had to figure out what was the best way to really test out some selectors.  So I went about just grabbing some site I came across while <a href="http://emevas1977.stumbleupon.com/" rel="nofollow">Stumbling</a>, but after doing some testing using that sites content I came to the realization that I would not know how to implement a "test" suite on my site.  So what I decided was to just implement an on the fly test suite on my content.</p>
<p>With that said, here we go:</p>
<p>If you do not have firebug installed, you will have a Firebug lite console pop up at the bottom of the screen.  If you do have Firebug installed, be sure to open it to follow along.</p>
<p>This page has <span id="domCount">x</span> DOM elements on it.  So, what ever selection we make will cycle/search through that total number of elements.</p>
<p>First up is to find an element with the ID of "shareThisBookmarkThisone" (this is the "Share this..." div that is currently hidden) and to select this element we will do:</p>
<div class="igBar"><span id="ljavascript-88"><a href="#" onclick="javascript:showPlainTxt('javascript-88'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">JavaScript:</span>
<div id="javascript-88">
<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;">"#shareThisBookmarkThisone"</span><span style="color: #66cc66;">&#41;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<input type="submit" name="submit" value="Run Test 1" id="shareThisBookmarkThisoneButton"/>
<p>After running that test you should have a number around 10 - 20 milliseconds.  In this case, it is the equivalent of "getElementById" which is a built in JavaScript method that searches for an element node with an id attribute whose value is "shareThisBookmarkThisoneButton."</p>
<p>Pretty simple selector, lets move onto another simple one that should be pretty fast.</p>
<p>On this page, I have <span id="divCount">x</span> DIV elements.</p>
<div class="igBar"><span id="ljavascript-89"><a href="#" onclick="javascript:showPlainTxt('javascript-89'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">JavaScript:</span>
<div id="javascript-89">
<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;">"div"</span><span style="color: #66cc66;">&#41;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<input type="submit" name="submit" value="Run Test 2" id="runTest2"/>
<p>After running that one, you should be looking at something between 0 - 10ms with Firefox about the 100ms range, once again, pretty simple.</p>
<p>Now let start getting into what selection methods are faster, say we want one of those DIVs with a class of "adspace," which approach would be faster?  One this page, I know we only have one to work with, so we should be able to get a reasonable return time.</p>
<p>Our first approach would be:</p>
<div class="igBar"><span id="ljavascript-90"><a href="#" onclick="javascript:showPlainTxt('javascript-90'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">JavaScript:</span>
<div id="javascript-90">
<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;">".adspace"</span><span style="color: #66cc66;">&#41;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<input type="submit" name="submit" value="Run Test 3" id="runTest3"/>
<div class="igBar"><span id="ljavascript-91"><a href="#" onclick="javascript:showPlainTxt('javascript-91'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">JavaScript:</span>
<div id="javascript-91">
<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;">"div.adspace"</span><span style="color: #66cc66;">&#41;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<input type="submit" name="submit" value="Run Test 4" id="runTest4"/>
<div class="igBar"><span id="ljavascript-92"><a href="#" onclick="javascript:showPlainTxt('javascript-92'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">JavaScript:</span>
<div id="javascript-92">
<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;">"div"</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">filter</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">".adspace"</span><span style="color: #66cc66;">&#41;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<input type="submit" name="submit" value="Run Test 5" id="runTest5"/>
<p>For "Test 3" we should get about 15ms in Firefox 2, Safari 3, between 0 - 16ms in Opera 9.2 and 0ms in IE6 and IE7, whereas we get 0ms across the board for "Test 4."  Now in "Test 5" we get 0ms for all except Firefox, where we get around 15ms.</p>
<p>What does the above tell us?  That if there is only one element things are quicker?  Not sure, but lets put that to the test, I posted some empty DIVs, some with a class of "selectMe" and others with some random classes, you can view the source to see what these DIVs look like.
<div class="selectMe"></div>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div class="selectMe"></div>
</div>
<dl>
<dd>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div class="selectMe"></div>
</dd>
</dl>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div class="selectMe"></div>
</div>
<dl>
<dd>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div class="selectMe"></div>
</dd>
</dl>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div class="selectMe"></div>
</div>
<dl>
<dd>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div class="selectMe"></div>
</dd>
</dl>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div class="selectMe"></div>
</div>
<dl>
<dd>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div class="selectMe"></div>
</dd>
</dl>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div class="selectMe"></div>
</div>
<dl>
<dd>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div class="selectMe"></div>
</dd>
</dl>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div class="selectMe"></div>
</div>
<dl>
<dd>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div class="selectMe"></div>
</dd>
</dl>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div class="selectMe"></div>
</div>
<dl>
<dd>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div class="selectMe"></div>
</dd>
</dl>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div class="selectMe"></div>
</div>
<dl>
<dd>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div class="selectMe"></div>
</dd>
</dl>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div class="selectMe"></div>
</div>
<dl>
<dd>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div class="selectMe"></div>
</dd>
</dl>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div class="selectMe"></div>
</div>
<dl>
<dd>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div class="sick"></div>
</dd>
</dl>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div class="selectMe"></div>
</div>
<dl>
<dd>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div class="selectMe"></div>
</dd>
</dl>
<div class="bike"></div>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div class="selectMe"></div>
</div>
<dl>
<dd>
<div class="selectMe"></div>
<div class="car"></div>
<div class="selectMe"></div>
</dd>
</dl>
<div class="selectMe"></div>
<div class="selectMe"></div>
<div class="igBar"><span id="ljavascript-93"><a href="#" onclick="javascript:showPlainTxt('javascript-93'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">JavaScript:</span>
<div id="javascript-93">
<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;">".adspace"</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;">&#40;</span><span style="color: #3366CC;">"div.adspace"</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;">&#40;</span><span style="color: #3366CC;">"div"</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">filter</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">".adspace"</span><span style="color: #66cc66;">&#41;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<input type="submit" name="submit" value="Run Test 6" id="runTest6"/>
<p>With "Test 6" we are looking getting back 153 results and I really must say that I am a little shocked by the results:</p>
<ul>
<li>IE7
<ul>
<li>6.1: 16ms</li>
<li>6.2: 15ms</li>
<li>6.3: 0ms</li>
</ul>
</li>
<li>Safari
<ul>
<li>6.1: 16ms</li>
<li>6.2: 0ms</li>
<li>6.3: 0ms</li>
</ul>
</li>
<li>Opera
<ul>
<li>6.1: 31ms</li>
<li>6.2: 0ms</li>
<li>6.3: 0ms</li>
</ul>
</li>
<li>Firefox with firebug
<ul>
<li>6.1: 141ms</li>
<li>6.2: 109ms</li>
<li>6.3: 109ms</li>
</ul>
</li>
<li>Firefox with firebug lite
<ul>
<li>6.1: 31ms</li>
<li>6.2: 0ms</li>
<li>6.3: 0ms</li>
</ul>
</li>
</ul>
<h5>Final Notes</h5>
<p>Before we get into what we learned let me put a bit of a disclaimer here.  I have not really looked into the full workings of the jQuery framework, so anything I say is based off of my assumptions and what I learned as I have built with it.  The numbers you see above are from browsers that are running on a not so average computer, so they are not from the average user's/client's computer.</p>
<p>What did we learn?  That if you are looking for all elements with a certain class and they are all of the same tag name, do $("TAGNAME.CLASSNAME") or $("TAGNAME").filter(".CLASSNAME").  That if you have only a single element that needs to be called and there will not be duplicates, your fastest selector is going to be the $("#ID") selector.  That<del datetime="2007-12-08T01:50:05+00:00">, with the exception of Firefox,</del> the leading browsers handle a TAG search pretty quickly.  Firefox had comparable speeds to the other browsers once firebug is turned off.</p>
<p>Something to keep in mind is that we did not do any manipulations, ie. css(), append(), animate(), or any really complex selectors and those will add time your actions.</p>
<p>jQuery is the library of choice for me, you are free to use any of the many libraries out there.</p>
<p><script type="text/javascript">
	$(document).ready(function(){
		if (!("console" in window) || !("firebug" in console)) {
			$("html").attr("debug","true");
			$("body").css("padding-bottom",200);
			$.getScript("/firebug/firebug.js");
		}
		$("#domCount").text($("*").size());
		$("#divCount").text($("div").size());
		$("#shareThisBookmarkThisoneButton").click(function(){
				console.time("test 1");
				var _this = $("#shareThisBookmarkThisone");
				console.log(_this);
				console.log("#shareThisBookmarkThisone count: " +_this.size());
				console.timeEnd("test 1");
			return false;
		});
		$("#runTest2").click(function(){
				console.time("test 2");
				var _this = $("div");
				console.log(_this);
				console.log("DIV count: " +_this.size());
				console.timeEnd("test 2");
			return false;
		});
		$("#runTest3").click(function(){
				console.time("test 3");
				var _this = $(".adspace");
				console.log(_this);
				console.log("DIV count: " +_this.size());
				console.timeEnd("test 3");
			return false;
		});
		$("#runTest4").click(function(){
				console.time("test 4");
				var _this = $("div.adspace");
				console.log(_this);
				console.log("DIV count: " +_this.size());
				console.timeEnd("test 4");
			return false;
		});
		$("#runTest5").click(function(){
				console.time("test 5");
				var _this = $("div").filter(".adspace");
				console.log(_this);
				console.log("DIV count: " +_this.size());
				console.timeEnd("test 5");
			return false;
		});
		$("#runTest6").click(function(){
				console.time("test 6.1");
				var _this = $(".selectMe");
				console.log(_this);
				console.log(".selectMe count: " +_this.size());
				console.timeEnd("test 6.1");
				console.time("test 6.2");
				var _this = $("div.selectMe");
				console.log(_this);
				console.log("div.selectMe count: " +_this.size());
				console.timeEnd("test 6.2");
				console.time("test 6.3");
				var _this = $("div").filter(".selectMe");
				console.log(_this);
				console.log("div filter selectMe count: " +_this.size());
				console.timeEnd("test 6.3");
			return false;
		});
	});
</script></p>
]]></content:encoded>
			<wfw:commentRss>http://benjaminsterling.com/jquery-what-are-the-fastest-selector/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>Accessible and Search Engine Friendly Image Rollover with CSS and Sprites</title>
		<link>http://benjaminsterling.com/accessible-and-search-engine-friendly-image-rollover-with-css-and-sprites/</link>
		<comments>http://benjaminsterling.com/accessible-and-search-engine-friendly-image-rollover-with-css-and-sprites/#comments</comments>
		<pubDate>Wed, 21 Nov 2007 04:09:09 +0000</pubDate>
		<dc:creator>Benjamin Sterling</dc:creator>
				<category><![CDATA[Accessibility]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[accessible]]></category>
		<category><![CDATA[image replacement]]></category>
		<category><![CDATA[image rollover]]></category>
		<category><![CDATA[search engine friendly]]></category>

		<guid isPermaLink="false">http://benjaminsterling.com/2007/11/21/accessible-and-search-engine-friendly-image-rollover-with-css-and-sprites/</guid>
		<description><![CDATA[I've been using StumbleUpon for a few weeks now and have found a ton of sites that have given me a ton of knowledge, some that have confirmed my thoughts of quite a few things and sites that just made me shake my head at. One such site was talking about CSS Image Rollovers and [...]]]></description>
			<content:encoded><![CDATA[<p>I've been using <a href="http://emevas1977.stumbleupon.com/" rel="nofollow">StumbleUpon </a> for a few weeks now and have found a ton of sites that have given me a ton of knowledge, some that have confirmed my thoughts of quite a few things and sites that just made me shake my head at.</p>
<p>One such site was talking about CSS Image Rollovers and their examples consisted of a &lt;A&gt; tag wrapping a none breaking line space, I won't post a link because I have actually seen quite a few other sites doing the same thing and don't want to single anyone out.  But what really made me frustrated is this particular site had a least 50 comments saying how great this was.  While I don't consider myself an expert there are a few things I truly believe in: clean code and accessibility.  As it stands now, my blog is not 100% accessible, there are things I need to do to make it better, and those things are in the works.</p>
<p>So, what I would like to do is show you a way of making image rollovers while being accessible, and  search engine friendly.</p>
<p>Say we have an image sprite like below (we can cover the pros and cons of image sprites in another post, these icons can be found at <a href="http://utombox.com/my-works/" target="_blank" rel="external">http://utombox.com/my-works/</a>):</p>
<p><img src="http://lh4.google.com/sterling.benjamin/R0OjFT33SsI/AAAAAAAAAkk/urjDwTHG8yk/s400/imageRollover.png"/></p>
<p><strong>The style sheet code:</strong></p>
<div class="igBar"><span id="lcss-96"><a href="#" onclick="javascript:showPlainTxt('css-96'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CSS:</span>
<div id="css-96">
<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;">.<span style="color: #993333;">icon</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: #000000; font-weight: bold;">display</span>:-moz-inline-box;</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; <span style="color: #000000; font-weight: bold;">overflow</span>:<span style="color: #993333;">hidden</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;">background</span>:<span style="color: #993333;">url</span><span style="color: #66cc66;">&#40;</span>imageRollover.png<span style="color: #66cc66;">&#41;</span> <span style="color: #993333;">no-repeat</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;">text-indent</span>: -3000px;</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;">text-indent</span>:0px;</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;">font</span>:<span style="color: #cc66cc;color:#800000;">0</span>/<span style="color: #cc66cc;color:#800000;">0</span> Arial;</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>:rgba<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;color:#800000;">255</span>,<span style="color: #cc66cc;color:#800000;">255</span>,<span style="color: #cc66cc;color:#800000;">255</span>,<span style="color: #cc66cc;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; <span style="color: #000000; font-weight: bold;">vertical-align</span>:<span style="color: #000000; font-weight: bold;">bottom</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;">width</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;">height</span>:100px;</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;">&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;">.iconYouTube<span style="color: #66cc66;">&#123;</span><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;">:hover.iconYouTube<span style="color: #66cc66;">&#123;</span>background-position<span style="color: #3333ff;">:-200px </span>0px;<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;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">.iconFlickr<span style="color: #66cc66;">&#123;</span>background-position<span style="color: #3333ff;">:-100px </span>0px;<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;">:hover.iconFlickr<span style="color: #66cc66;">&#123;</span>background-position<span style="color: #3333ff;">:-300px </span>0px;<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;</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;">.iconRss<span style="color: #66cc66;">&#123;</span>background-position<span style="color: #3333ff;">:0px </span>-100px;<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;">:hover.iconRss<span style="color: #66cc66;">&#123;</span>background-position<span style="color: #3333ff;">:-200px </span>-100px;<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;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">.iconFeedburner<span style="color: #66cc66;">&#123;</span>background-position<span style="color: #3333ff;">:0px </span>-200px;<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;">:hover.iconFeedburner<span style="color: #66cc66;">&#123;</span>background-position<span style="color: #3333ff;">:-200px </span>-200px;<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;</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;">.iconDelicious<span style="color: #66cc66;">&#123;</span>background-position<span style="color: #3333ff;">:-100px </span>-200px;<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;">:hover.iconDelicious<span style="color: #66cc66;">&#123;</span>background-position<span style="color: #3333ff;">:-300px </span>-200px;<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;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">.iconTechnorati<span style="color: #66cc66;">&#123;</span>background-position<span style="color: #3333ff;">:-100px </span>-100px;<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;">:hover.iconTechnorati<span style="color: #66cc66;">&#123;</span>background-position<span style="color: #3333ff;">:-300px </span>-100px;<span style="color: #66cc66;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p><br/><br />
<strong>The Html code:</strong></p>
<div class="igBar"><span id="lhtml-97"><a href="#" onclick="javascript:showPlainTxt('html-97'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">HTML:</span>
<div id="html-97">
<div class="html">
<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;"><a href="http://december.com/html/4/element/a.html"><span style="color: #000000; font-weight: bold;">&lt;a</span></a> <span style="color: #000066;">href</span>=<span style="color: #ff0000;">""</span> <span style="color: #000066;">title</span>=<span style="color: #ff0000;">"youtube icon"</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">"icon iconYouTube"</span><span style="color: #000000; font-weight: bold;">&gt;</span></a></span>youtube icon<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/a&gt;</span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><a href="http://december.com/html/4/element/a.html"><span style="color: #000000; font-weight: bold;">&lt;a</span></a> <span style="color: #000066;">href</span>=<span style="color: #ff0000;">""</span> <span style="color: #000066;">title</span>=<span style="color: #ff0000;">"flickr icon"</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">"icon iconFlickr"</span><span style="color: #000000; font-weight: bold;">&gt;</span></a></span>flickr icon<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/a&gt;</span></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: #009900;"><a href="http://december.com/html/4/element/a.html"><span style="color: #000000; font-weight: bold;">&lt;a</span></a> <span style="color: #000066;">href</span>=<span style="color: #ff0000;">""</span> <span style="color: #000066;">title</span>=<span style="color: #ff0000;">"rss icon"</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">"icon iconRss"</span><span style="color: #000000; font-weight: bold;">&gt;</span></a></span>rss icon<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/a&gt;</span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><a href="http://december.com/html/4/element/a.html"><span style="color: #000000; font-weight: bold;">&lt;a</span></a> <span style="color: #000066;">href</span>=<span style="color: #ff0000;">""</span> <span style="color: #000066;">title</span>=<span style="color: #ff0000;">"feedburner icon"</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">"icon iconFeedburner"</span><span style="color: #000000; font-weight: bold;">&gt;</span></a></span>feedburner icon<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/a&gt;</span></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: #009900;"><a href="http://december.com/html/4/element/a.html"><span style="color: #000000; font-weight: bold;">&lt;a</span></a> <span style="color: #000066;">href</span>=<span style="color: #ff0000;">""</span> <span style="color: #000066;">title</span>=<span style="color: #ff0000;">"delicious icon"</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">"icon iconDelicious"</span><span style="color: #000000; font-weight: bold;">&gt;</span></a></span>delicious icon<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/a&gt;</span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><a href="http://december.com/html/4/element/a.html"><span style="color: #000000; font-weight: bold;">&lt;a</span></a> <span style="color: #000066;">href</span>=<span style="color: #ff0000;">""</span> <span style="color: #000066;">title</span>=<span style="color: #ff0000;">"technorati icon"</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">"icon iconTechnorati"</span><span style="color: #000000; font-weight: bold;">&gt;</span></a></span>technorati icon<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/a&gt;</span></span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p><br/><br />
<strong>The outcome:</strong></p>
<style>.icon{display:-moz-inline-box !important; display:inline-block !important; overflow:hidden !important; background:url(http://lh4.google.com/sterling.benjamin/R0OjFT33SsI/AAAAAAAAAkk/urjDwTHG8yk/s400/imageRollover.png) no-repeat; text-indent: -3000px; *text-indent:0px;font:0/0 Arial  !important; color:rgba(255,255,255,0) !important;vertical-align:bottom !important;width:100px !important;height:100px !important;} .iconYouTube{} :hover.iconYouTube{background-position:-200px 0px;} .iconFlickr{background-position:-100px 0px;} :hover.iconFlickr{background-position:-300px 0px;} .iconRss{background-position:0px -100px;} :hover.iconRss{background-position:-200px -100px;} .iconFeedburner{background-position:0px -200px;} :hover.iconFeedburner{background-position:-200px -200px;} .iconDelicious{background-position:-100px -200px;} :hover.iconDelicious{background-position:-300px -200px;} .iconTechnorati{background-position:-100px -100px;} :hover.iconTechnorati{background-position:-300px -100px;}</style>
<p><a href="" title="youtube icon" class="icon iconYouTube">youtube icon</a><a href="" title="flickr icon" class="icon iconFlickr">flickr icon</a><a href="" title="rss icon" class="icon iconRss">rss icon</a><a href="" title="feedburner icon" class="icon iconFeedburner">feedburner icon</a><a href="" title="delicious icon" class="icon iconDelicious">delicious icon</a><a href="" title="technorati icon" class="icon iconTechnorati">technorati icon</a></p>
<p><script type="text/javascript"><!--
google_ad_client = "pub-9213319579769471";
//between 1
google_ad_slot = "9115797393";
google_ad_width = 400;
google_ad_height = 15;
//--></script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></p>
<p><br/><br />
<strong>The Explanation:</strong><br />
Lets start off with the easy things to explain; in the instance above I am using an <a href="http://www.alistapart.com/articles/sprites" target="_blank" rel="nofollow">image sprite</a> which, depending on how many external elements you need to load, will speed up load time.  In the first class <strong>icon</strong> we are setting the background as the sprite and then proceeding classes we simply position the background image to get the desired image showing with both the default image and the hover.</p>
<p>The hard thing to explain, at least for me, is what everything in the <strong>icon</strong> class is doing.  I will try, but if I mess something up, call me on it.</p>
<ul>
<li>
		display</p>
<ul>
<li>-moz-inline-box: for mozilla based browsers</li>
<li>inline-block: supported by IE and all other grade-A browsers</li>
</ul>
</li>
<li>
		overflow</p>
<ul>
<li>hidden: make everything hidden if it is outside the box (ie6, you know I talking about you)</li>
</ul>
</li>
<li>
		background</p>
<ul>
<li>url: ummm... the background image</li>
</ul>
</li>
<li>
		text-indent</p>
<ul>
<li>without *: 	applies to only block-level elements, table cells and inline blocks, since we are using -moz-inline-box, firebox will not use this</li>
<li>with *: IE does not support it correctly, so we set it back to 0</li>
</ul>
</li>
<li>
		font</p>
<ul>
<li>0/0 Arial: this is to set the text to a very small size, there are some browsers that do not support this shorthand, but I can't remember which ones off hand.</li>
</ul>
</li>
<li>
		color</p>
<ul>
<li>rgba(255,255,255,0): this is a css3 spec and is only being supported by safari and firefox 3</li>
</ul>
</li>
<li>
		vertical-align</p>
<ul>
<li>bottom: this is required for block elements to keep them inline with text</li>
</ul>
</li>
</ul>
<p><script type="text/javascript"><!--
google_ad_client = "pub-9213319579769471";
//between 1
google_ad_slot = "9115797393";
google_ad_width = 400;
google_ad_height = 15;
//--></script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></p>
<p><br/><br />
<strong>The Small Print:</strong><br />
There are some thing to consider when doing the rollovers or image replacements in general; it is not 100% accessible, meaning, although screen readers will be able to pick it up, people that can see, but have poor vision will not be able to set the font any bigger then what you have in your image.</p>
<p>With that said, have fun with it.  Any questions comments or concerns, feel free to drop a line.</p>
<p><strong>Update 11/21/2007:</strong> Came across a really nice article about <a href="http://css-tricks.com/css-sprites-what-they-are-why-theyre-cool-and-how-to-use-them/">css sprites</a>, very good read.</p>
]]></content:encoded>
			<wfw:commentRss>http://benjaminsterling.com/accessible-and-search-engine-friendly-image-rollover-with-css-and-sprites/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

