<?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>Greg Smith Mobile &#38; Web Developer</title>
	<atom:link href="http://gregdev.com.au/feed/" rel="self" type="application/rss+xml" />
	<link>http://gregdev.com.au</link>
	<description>The portfolio and blog of Web developer Greg Smith</description>
	<lastBuildDate>Fri, 17 May 2013 23:07:00 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<item>
		<title>Add a Save and Close button to WordPress</title>
		<link>http://gregdev.com.au/wordpress/add-a-save-and-close-button-to-wordpress/</link>
		<comments>http://gregdev.com.au/wordpress/add-a-save-and-close-button-to-wordpress/#comments</comments>
		<pubDate>Wed, 27 Mar 2013 04:45:39 +0000</pubDate>
		<dc:creator>greg</dc:creator>
				<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://gregdev.com.au/?p=402</guid>
		<description><![CDATA[<p>Lightbulb Digital (where I happen to work!) has just released the Save and Close plugin for WordPress, which adds a new button to the post edit page in the WordPress backend which allows you to instantly go back to the post listing page after you&#8217;ve finished creating or updating a post. The plugin works for posts, [...]</p><p>The post <a href="http://gregdev.com.au/wordpress/add-a-save-and-close-button-to-wordpress/">Add a Save and Close button to WordPress</a> appeared first on <a href="http://gregdev.com.au">Greg Smith Mobile &amp; Web Developer</a>.</p>]]></description>
				<content:encoded><![CDATA[<p><a href="http://lightbulbdigital.com.au">Lightbulb Digital</a> (where I happen to work!) has just released the <a href="http://wordpress.org/extend/plugins/lightbulb-save-and-close/">Save and Close</a> plugin for WordPress, which adds a new button to the post edit page in the WordPress backend which allows you to instantly go back to the post listing page after you&#8217;ve finished creating or updating a post. The plugin works for posts, pages and any other post type you care to mention.</p>
<p>Right now there&#8217;s no options or settings &#8211; just install the plugin and save your fingers from clicking too much. If you run into any problems or have any suggestions, please share them on the <a href="http://wordpress.org/support/plugin/lightbulb-save-and-close">plugin forum on wordpress.org</a> and we&#8217;ll get right on it!</p>
<p>&nbsp;</p>
<p>The post <a href="http://gregdev.com.au/wordpress/add-a-save-and-close-button-to-wordpress/">Add a Save and Close button to WordPress</a> appeared first on <a href="http://gregdev.com.au">Greg Smith Mobile &amp; Web Developer</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://gregdev.com.au/wordpress/add-a-save-and-close-button-to-wordpress/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using jQuery to make two (or more) columns the same height</title>
		<link>http://gregdev.com.au/jquery/using-jquery-to-make-two-or-more-columns-the-same-height/</link>
		<comments>http://gregdev.com.au/jquery/using-jquery-to-make-two-or-more-columns-the-same-height/#comments</comments>
		<pubDate>Sat, 25 Jun 2011 13:15:18 +0000</pubDate>
		<dc:creator>greg</dc:creator>
				<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://gregdev.net/?p=235</guid>
		<description><![CDATA[<p>Two columns of equal height used to be an easy thing to accomplish back in the good old table-based layout days. It&#8217;s not so simple now. There are several methods which will give this effect, such as setting background images, but this isn&#8217;t the most elegant solution. Here&#8217;s a really simple jQuery method which will [...]</p><p>The post <a href="http://gregdev.com.au/jquery/using-jquery-to-make-two-or-more-columns-the-same-height/">Using jQuery to make two (or more) columns the same height</a> appeared first on <a href="http://gregdev.com.au">Greg Smith Mobile &amp; Web Developer</a>.</p>]]></description>
				<content:encoded><![CDATA[<p>Two columns of equal height used to be an easy thing to accomplish back in the good old table-based layout days. It&#8217;s not so simple now. There are several methods which will give this effect, such as setting background images, but this isn&#8217;t the most elegant solution.</p>
<p>Here&#8217;s a really simple jQuery method which will set two or more elements to the height of the largest of those elements. All you need to do is add a common class to the elements.</p>
<h3>The HTML</h3>
<p>Here&#8217;s some sample HTML to get us going:</p>

<div class="bwp-syntax-block clearfix">
<div class="bwp-syntax-toolbar"><div class="bwp-syntax-control"><a href="javascript:;" class="bwp-syntax-source-switch" title="View Source Code"></a></div></div>
<div class="bwp-syntax-wrapper clearfix bwp-syntax-simple"><table class="html4strict"><tbody><tr class="li1"><td class="ln"><pre class="de1">1
2
3
4
5
6
7
8
9
10
11
12
13
14
</pre></td><td class="de1"><pre class="de1"><span class="sc2">&lt;<span class="kw2">div</span> <span class="kw3">class</span><span class="sy0">=</span><span class="st0">&quot;col1 sameheight&quot;</span> <span class="kw3">style</span><span class="sy0">=</span><span class="st0">&quot;border: 1px solid red; float: left; margin-right: 10px&quot;</span>&gt;</span>
&nbsp; &nbsp; <span class="sc2">&lt;<span class="kw2">p</span>&gt;</span>This is a test<span class="sc2">&lt;<span class="sy0">/</span><span class="kw2">p</span>&gt;</span>
<span class="sc2">&lt;<span class="sy0">/</span><span class="kw2">div</span>&gt;</span>
&nbsp;
<span class="sc2">&lt;<span class="kw2">div</span> <span class="kw3">class</span><span class="sy0">=</span><span class="st0">&quot;col2 sameheight&quot;</span> <span class="kw3">style</span><span class="sy0">=</span><span class="st0">&quot;border: 1px solid red; float: left; margin-right: 10px&quot;</span>&gt;</span>
&nbsp; &nbsp; <span class="sc2">&lt;<span class="kw2">p</span>&gt;</span>This is a test<span class="sc2">&lt;<span class="sy0">/</span><span class="kw2">p</span>&gt;</span>
&nbsp; &nbsp; <span class="sc2">&lt;<span class="kw2">p</span>&gt;</span>This is a test<span class="sc2">&lt;<span class="sy0">/</span><span class="kw2">p</span>&gt;</span>
<span class="sc2">&lt;<span class="sy0">/</span><span class="kw2">div</span>&gt;</span>
&nbsp;
<span class="sc2">&lt;<span class="kw2">div</span> <span class="kw3">class</span><span class="sy0">=</span><span class="st0">&quot;col3 sameheight&quot;</span> <span class="kw3">style</span><span class="sy0">=</span><span class="st0">&quot;border: 1px solid red; float: left; margin-right: 10px&quot;</span>&gt;</span>
&nbsp; &nbsp; <span class="sc2">&lt;<span class="kw2">p</span>&gt;</span>This is a test<span class="sc2">&lt;<span class="sy0">/</span><span class="kw2">p</span>&gt;</span>
&nbsp; &nbsp; <span class="sc2">&lt;<span class="kw2">p</span>&gt;</span>This is a test<span class="sc2">&lt;<span class="sy0">/</span><span class="kw2">p</span>&gt;</span>
&nbsp; &nbsp; <span class="sc2">&lt;<span class="kw2">p</span>&gt;</span>This is a test<span class="sc2">&lt;<span class="sy0">/</span><span class="kw2">p</span>&gt;</span>
<span class="sc2">&lt;<span class="sy0">/</span><span class="kw2">div</span>&gt;</span></pre></td></tr></tbody></table></div>
<div class="bwp-syntax-source"><pre class="no-parse">&lt;div class="col1 sameheight" style="border: 1px solid red; float: left; margin-right: 10px"&gt;
	&lt;p&gt;This is a test&lt;/p&gt;
&lt;/div&gt;

&lt;div class="col2 sameheight" style="border: 1px solid red; float: left; margin-right: 10px"&gt;
	&lt;p&gt;This is a test&lt;/p&gt;
	&lt;p&gt;This is a test&lt;/p&gt;
&lt;/div&gt;

&lt;div class="col3 sameheight" style="border: 1px solid red; float: left; margin-right: 10px"&gt;
	&lt;p&gt;This is a test&lt;/p&gt;
	&lt;p&gt;This is a test&lt;/p&gt;
	&lt;p&gt;This is a test&lt;/p&gt;
&lt;/div&gt;</pre></div></div>

<p>This will create three columns, each with a different amount of content (and therefore of a different size). Note that they all have a common class (sameheight)</p>
<h3>The JavaScript</h3>
<p>First we&#8217;ll create a jQuery plugin which finds each element with a specified class and measure its height. We&#8217;ll keep track of the greatest column height with a variable, initially set to 0; if a column has a height greater than the current greatest column height, we&#8217;ll update this variable with the height of this column.</p>

<div class="bwp-syntax-block clearfix">
<div class="bwp-syntax-toolbar"><div class="bwp-syntax-control"><a href="javascript:;" class="bwp-syntax-source-switch" title="View Source Code"></a></div></div>
<div class="bwp-syntax-wrapper clearfix bwp-syntax-simple"><table class="javascript"><tbody><tr class="li1"><td class="ln"><pre class="de1">1
2
3
4
5
6
7
8
9
10
11
</pre></td><td class="de1"><pre class="de1"><span class="sy0">&lt;</span>script type<span class="sy0">=</span><span class="st0">&quot;text/javascript&quot;</span><span class="sy0">&gt;</span>
&nbsp; &nbsp; $.<span class="me1">fn</span>.<span class="me1">equalHeightify</span> <span class="sy0">=</span> <span class="kw2">function</span><span class="br0">&#40;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span>
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw2">var</span> highest <span class="sy0">=</span> <span class="nu0">0</span><span class="sy0">;</span> <span class="co1">// keep track of the greatest height</span>
&nbsp; &nbsp; &nbsp; &nbsp; $<span class="br0">&#40;</span><span class="kw1">this</span><span class="br0">&#41;</span>.<span class="me1">each</span><span class="br0">&#40;</span><span class="kw2">function</span><span class="br0">&#40;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span> <span class="co1">// for each element</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>$<span class="br0">&#40;</span><span class="kw1">this</span><span class="br0">&#41;</span>.<span class="me1">height</span><span class="br0">&#40;</span><span class="br0">&#41;</span> <span class="sy0">&gt;</span> highest<span class="br0">&#41;</span> <span class="br0">&#123;</span> <span class="co1">// compare heights</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; highest <span class="sy0">=</span> $<span class="br0">&#40;</span><span class="kw1">this</span><span class="br0">&#41;</span>.<span class="me1">height</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span>
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><span class="br0">&#41;</span><span class="sy0">;</span>
&nbsp; &nbsp; &nbsp; &nbsp; $<span class="br0">&#40;</span><span class="kw1">this</span><span class="br0">&#41;</span>.<span class="me1">height</span><span class="br0">&#40;</span>highest<span class="br0">&#41;</span><span class="sy0">;</span> <span class="co1">// set new height</span>
&nbsp; &nbsp; <span class="br0">&#125;</span>
<span class="sy0">&lt;/</span>script<span class="sy0">&gt;</span></pre></td></tr></tbody></table></div>
<div class="bwp-syntax-source"><pre class="no-parse">&lt;script type="text/javascript"&gt;
	$.fn.equalHeightify = function() {
		var highest = 0; // keep track of the greatest height
		$(this).each(function() { // for each element
			if ($(this).height() &gt; highest) { // compare heights
				highest = $(this).height();
			}
		});
		$(this).height(highest); // set new height
	}
&lt;/script&gt;</pre></div></div>

<p>Now we can run our class on the three columns:</p>

<div class="bwp-syntax-block clearfix">
<div class="bwp-syntax-toolbar"><div class="bwp-syntax-control"><a href="javascript:;" class="bwp-syntax-source-switch" title="View Source Code"></a></div></div>
<div class="bwp-syntax-wrapper clearfix bwp-syntax-simple"><table class="javascript"><tbody><tr class="li1"><td class="ln"><pre class="de1">1
2
3
4
5
</pre></td><td class="de1"><pre class="de1"><span class="sy0">&lt;</span>script type<span class="sy0">=</span><span class="st0">&quot;text/javascript&quot;</span><span class="sy0">&gt;</span>
&nbsp; &nbsp; $<span class="br0">&#40;</span>document<span class="br0">&#41;</span>.<span class="me1">ready</span><span class="br0">&#40;</span><span class="kw2">function</span><span class="br0">&#40;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span>
&nbsp; &nbsp; &nbsp; &nbsp; $<span class="br0">&#40;</span><span class="st0">'.sameheight'</span><span class="br0">&#41;</span>.<span class="me1">equalHeightify</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span>
&nbsp; &nbsp; <span class="br0">&#125;</span><span class="br0">&#41;</span><span class="sy0">;</span>
<span class="sy0">&lt;/</span>script<span class="sy0">&gt;</span></pre></td></tr></tbody></table></div>
<div class="bwp-syntax-source"><pre class="no-parse">&lt;script type="text/javascript"&gt;
	$(document).ready(function() {
		$('.sameheight').equalHeightify();
	});
&lt;/script&gt;</pre></div></div>

<h3>The Result</h3>
<div class="sameheight" style="border: 1px solid red; float: left; margin-right: 10px">
<p>This is a test</p>
</div>
<div class="sameheight" style="border: 1px solid red; float: left; margin-right: 10px">
<p>This is a test</p>
<p>This is a test</p>
</div>
<div class="sameheight" style="border: 1px solid red; float: left; margin-right: 10px">
<p>This is a test</p>
<p>This is a test</p>
<p>This is a test</p>
</div>
<div class="clearfix"></div>
<p>You can use this plugin multiple times; just set a different class on each set of columns you want to set as the same height.</p>
<p>The post <a href="http://gregdev.com.au/jquery/using-jquery-to-make-two-or-more-columns-the-same-height/">Using jQuery to make two (or more) columns the same height</a> appeared first on <a href="http://gregdev.com.au">Greg Smith Mobile &amp; Web Developer</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://gregdev.com.au/jquery/using-jquery-to-make-two-or-more-columns-the-same-height/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Create a (really) simple multi level drop down menu</title>
		<link>http://gregdev.com.au/jquery/create-a-really-simple-multi-level-drop-down-menu/</link>
		<comments>http://gregdev.com.au/jquery/create-a-really-simple-multi-level-drop-down-menu/#comments</comments>
		<pubDate>Sat, 28 May 2011 03:31:25 +0000</pubDate>
		<dc:creator>greg</dc:creator>
				<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://gregdev.net/?p=163</guid>
		<description><![CDATA[<p>Drop down menus are pretty popular on the Web these days. There are a lot of pre-built solutions out there which are freely available, but a lot of them come with unmanageable markup and an excessive amount of included CSS. So here&#8217;s a really simple way to add a jQuery-powered drop down menu to your [...]</p><p>The post <a href="http://gregdev.com.au/jquery/create-a-really-simple-multi-level-drop-down-menu/">Create a (really) simple multi level drop down menu</a> appeared first on <a href="http://gregdev.com.au">Greg Smith Mobile &amp; Web Developer</a>.</p>]]></description>
				<content:encoded><![CDATA[<p>Drop down menus are pretty popular on the Web these days. There are a lot of pre-built solutions out there which are freely available, but a lot of them come with unmanageable markup and an excessive amount of included CSS. So here&#8217;s a really simple way to add a jQuery-powered drop down menu to your own Web site using simple markup and whatever CSS you like.</p>
<h3>The Demo</h3>
<p>Here&#8217;s our finished product with just a little bit of CSS to get it started:</p>
<ul id="dd_menu">
<li><a href="#">Menu Item 1</a>
<ul>
<li><a href="#">Sub item 1.1</a></li>
<li><a href="#">Sub item 1.2</a></li>
<li><a href="#">Sub item 1.3 &raquo;</a>
<ul>
<li><a href="#">Sub sub item 1.3.1</a></li>
<li><a href="#">Sub sub item 1.3.2</a></li>
<li><a href="#">Sub sub item 1.3.3</a></li>
</ul>
</li>
</ul>
</li>
<li><a href="#">Menu Item 2</a>
<ul>
<li><a href="#">Sub item 2.1</a></li>
<li><a href="#">Sub item 2.2</a></li>
<li><a href="#">Sub item 2.3</a></li>
</ul>
</li>
<li><a href="#">Menu Item 3</a>
<ul>
<li><a href="#">Sub item 3.1</a></li>
<li><a href="#">Sub item 3.2</a></li>
<li><a href="#">Sub item 3.3</a></li>
</ul>
</li>
</ul>
<h3>The HTML</h3>
<p>First, the easy part; we need a list of menu items.</p>

<div class="bwp-syntax-block clearfix">
<div class="bwp-syntax-toolbar" style="right: 15px;" ><div class="bwp-syntax-control"><a href="javascript:;" class="bwp-syntax-source-switch" title="View Source Code"></a></div></div>
<div class="bwp-syntax-wrapper clearfix bwp-syntax-simple"style=" height: 252px;"><table class="html4strict"><tbody><tr class="li1"><td class="ln"><pre class="de1">1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
</pre></td><td class="de1"><pre class="de1"><span class="sc2">&lt;<span class="kw2">ul</span> <span class="kw3">id</span><span class="sy0">=</span><span class="st0">&quot;dd_menu&quot;</span>&gt;</span>
&nbsp; &nbsp; <span class="sc2">&lt;<span class="kw2">li</span>&gt;&lt;<span class="kw2">a</span> <span class="kw3">href</span><span class="sy0">=</span><span class="st0">&quot;#&quot;</span>&gt;</span>Menu Item 1<span class="sc2">&lt;<span class="sy0">/</span><span class="kw2">a</span>&gt;</span>
&nbsp; &nbsp; &nbsp; &nbsp; <span class="sc2">&lt;<span class="kw2">ul</span>&gt;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="sc2">&lt;<span class="kw2">li</span>&gt;&lt;<span class="kw2">a</span> <span class="kw3">href</span><span class="sy0">=</span><span class="st0">&quot;#&quot;</span>&gt;</span>Sub item 1.1<span class="sc2">&lt;<span class="sy0">/</span><span class="kw2">a</span>&gt;&lt;<span class="sy0">/</span><span class="kw2">li</span>&gt;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="sc2">&lt;<span class="kw2">li</span>&gt;&lt;<span class="kw2">a</span> <span class="kw3">href</span><span class="sy0">=</span><span class="st0">&quot;#&quot;</span>&gt;</span>Sub item 1.2<span class="sc2">&lt;<span class="sy0">/</span><span class="kw2">a</span>&gt;&lt;<span class="sy0">/</span><span class="kw2">li</span>&gt;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="sc2">&lt;<span class="kw2">li</span>&gt;&lt;<span class="kw2">a</span> <span class="kw3">href</span><span class="sy0">=</span><span class="st0">&quot;#&quot;</span>&gt;</span>Sub item 1.3 <span class="sc1">&amp;raquo;</span><span class="sc2">&lt;<span class="sy0">/</span><span class="kw2">a</span>&gt;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="sc2">&lt;<span class="kw2">ul</span>&gt;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="sc2">&lt;<span class="kw2">li</span>&gt;&lt;<span class="kw2">a</span> <span class="kw3">href</span><span class="sy0">=</span><span class="st0">&quot;#&quot;</span>&gt;</span>Sub sub item 1.3.1<span class="sc2">&lt;<span class="sy0">/</span><span class="kw2">a</span>&gt;&lt;<span class="sy0">/</span><span class="kw2">li</span>&gt;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="sc2">&lt;<span class="kw2">li</span>&gt;&lt;<span class="kw2">a</span> <span class="kw3">href</span><span class="sy0">=</span><span class="st0">&quot;#&quot;</span>&gt;</span>Sub sub item 1.3.2<span class="sc2">&lt;<span class="sy0">/</span><span class="kw2">a</span>&gt;&lt;<span class="sy0">/</span><span class="kw2">li</span>&gt;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="sc2">&lt;<span class="kw2">li</span>&gt;&lt;<span class="kw2">a</span> <span class="kw3">href</span><span class="sy0">=</span><span class="st0">&quot;#&quot;</span>&gt;</span>Sub sub item 1.3.3<span class="sc2">&lt;<span class="sy0">/</span><span class="kw2">a</span>&gt;&lt;<span class="sy0">/</span><span class="kw2">li</span>&gt;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="sc2">&lt;<span class="sy0">/</span><span class="kw2">ul</span>&gt;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="sc2">&lt;<span class="sy0">/</span><span class="kw2">li</span>&gt;</span>
&nbsp; &nbsp; &nbsp; &nbsp; <span class="sc2">&lt;<span class="sy0">/</span><span class="kw2">ul</span>&gt;</span>
&nbsp; &nbsp; <span class="sc2">&lt;<span class="sy0">/</span><span class="kw2">li</span>&gt;</span>
&nbsp; &nbsp; <span class="sc2">&lt;<span class="kw2">li</span>&gt;&lt;<span class="kw2">a</span> <span class="kw3">href</span><span class="sy0">=</span><span class="st0">&quot;#&quot;</span>&gt;</span>Menu Item 2<span class="sc2">&lt;<span class="sy0">/</span><span class="kw2">a</span>&gt;</span>
&nbsp; &nbsp; &nbsp; &nbsp; <span class="sc2">&lt;<span class="kw2">ul</span>&gt;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="sc2">&lt;<span class="kw2">li</span>&gt;&lt;<span class="kw2">a</span> <span class="kw3">href</span><span class="sy0">=</span><span class="st0">&quot;#&quot;</span>&gt;</span>Sub item 2.1<span class="sc2">&lt;<span class="sy0">/</span><span class="kw2">a</span>&gt;&lt;<span class="sy0">/</span><span class="kw2">li</span>&gt;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="sc2">&lt;<span class="kw2">li</span>&gt;&lt;<span class="kw2">a</span> <span class="kw3">href</span><span class="sy0">=</span><span class="st0">&quot;#&quot;</span>&gt;</span>Sub item 2.2<span class="sc2">&lt;<span class="sy0">/</span><span class="kw2">a</span>&gt;&lt;<span class="sy0">/</span><span class="kw2">li</span>&gt;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="sc2">&lt;<span class="kw2">li</span>&gt;&lt;<span class="kw2">a</span> <span class="kw3">href</span><span class="sy0">=</span><span class="st0">&quot;#&quot;</span>&gt;</span>Sub item 2.3<span class="sc2">&lt;<span class="sy0">/</span><span class="kw2">a</span>&gt;&lt;<span class="sy0">/</span><span class="kw2">li</span>&gt;</span>
&nbsp; &nbsp; &nbsp; &nbsp; <span class="sc2">&lt;<span class="sy0">/</span><span class="kw2">ul</span>&gt;</span>
&nbsp; &nbsp; <span class="sc2">&lt;<span class="sy0">/</span><span class="kw2">li</span>&gt;</span>
&nbsp; &nbsp; <span class="sc2">&lt;<span class="kw2">li</span>&gt;&lt;<span class="kw2">a</span> <span class="kw3">href</span><span class="sy0">=</span><span class="st0">&quot;#&quot;</span>&gt;</span>Menu Item 3<span class="sc2">&lt;<span class="sy0">/</span><span class="kw2">a</span>&gt;</span>
&nbsp; &nbsp; &nbsp; &nbsp; <span class="sc2">&lt;<span class="kw2">ul</span>&gt;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="sc2">&lt;<span class="kw2">li</span>&gt;&lt;<span class="kw2">a</span> <span class="kw3">href</span><span class="sy0">=</span><span class="st0">&quot;#&quot;</span>&gt;</span>Sub item 3.1<span class="sc2">&lt;<span class="sy0">/</span><span class="kw2">a</span>&gt;&lt;<span class="sy0">/</span><span class="kw2">li</span>&gt;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="sc2">&lt;<span class="kw2">li</span>&gt;&lt;<span class="kw2">a</span> <span class="kw3">href</span><span class="sy0">=</span><span class="st0">&quot;#&quot;</span>&gt;</span>Sub item 3.2<span class="sc2">&lt;<span class="sy0">/</span><span class="kw2">a</span>&gt;&lt;<span class="sy0">/</span><span class="kw2">li</span>&gt;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="sc2">&lt;<span class="kw2">li</span>&gt;&lt;<span class="kw2">a</span> <span class="kw3">href</span><span class="sy0">=</span><span class="st0">&quot;#&quot;</span>&gt;</span>Sub item 3.3<span class="sc2">&lt;<span class="sy0">/</span><span class="kw2">a</span>&gt;&lt;<span class="sy0">/</span><span class="kw2">li</span>&gt;</span>
&nbsp; &nbsp; &nbsp; &nbsp; <span class="sc2">&lt;<span class="sy0">/</span><span class="kw2">ul</span>&gt;</span>
&nbsp; &nbsp; <span class="sc2">&lt;<span class="sy0">/</span><span class="kw2">li</span>&gt;</span>
<span class="sc2">&lt;<span class="sy0">/</span><span class="kw2">ul</span>&gt;</span></pre></td></tr></tbody></table></div>
<div class="bwp-syntax-source"><pre class="no-parse">&lt;ul id="dd_menu"&gt;
	&lt;li&gt;&lt;a href="#"&gt;Menu Item 1&lt;/a&gt;
		&lt;ul&gt;
			&lt;li&gt;&lt;a href="#"&gt;Sub item 1.1&lt;/a&gt;&lt;/li&gt;
			&lt;li&gt;&lt;a href="#"&gt;Sub item 1.2&lt;/a&gt;&lt;/li&gt;
			&lt;li&gt;&lt;a href="#"&gt;Sub item 1.3 &amp;raquo;&lt;/a&gt;
				&lt;ul&gt;
					&lt;li&gt;&lt;a href="#"&gt;Sub sub item 1.3.1&lt;/a&gt;&lt;/li&gt;
					&lt;li&gt;&lt;a href="#"&gt;Sub sub item 1.3.2&lt;/a&gt;&lt;/li&gt;
					&lt;li&gt;&lt;a href="#"&gt;Sub sub item 1.3.3&lt;/a&gt;&lt;/li&gt;
				&lt;/ul&gt;
			&lt;/li&gt;
		&lt;/ul&gt;
	&lt;/li&gt;
	&lt;li&gt;&lt;a href="#"&gt;Menu Item 2&lt;/a&gt;
		&lt;ul&gt;
			&lt;li&gt;&lt;a href="#"&gt;Sub item 2.1&lt;/a&gt;&lt;/li&gt;
			&lt;li&gt;&lt;a href="#"&gt;Sub item 2.2&lt;/a&gt;&lt;/li&gt;
			&lt;li&gt;&lt;a href="#"&gt;Sub item 2.3&lt;/a&gt;&lt;/li&gt;
		&lt;/ul&gt;
	&lt;/li&gt;
	&lt;li&gt;&lt;a href="#"&gt;Menu Item 3&lt;/a&gt;
		&lt;ul&gt;
			&lt;li&gt;&lt;a href="#"&gt;Sub item 3.1&lt;/a&gt;&lt;/li&gt;
			&lt;li&gt;&lt;a href="#"&gt;Sub item 3.2&lt;/a&gt;&lt;/li&gt;
			&lt;li&gt;&lt;a href="#"&gt;Sub item 3.3&lt;/a&gt;&lt;/li&gt;
		&lt;/ul&gt;
	&lt;/li&gt;
&lt;/ul&gt;</pre></div></div>

<p>This is pretty simple markup. All we have are some nested lists, and one ID attribute to identify the menu. If you want to add in some fancy styling you might like to sprinkle in a few class attributes.</p>
<h3>The JavaScript</h3>
<p>This is a jQuery-powered menu, so we&#8217;ll need to throw in a reference to jQuery. You can <a href="http://jquery.com">download a copy yourself</a>, or use Google&#8217;s hosted version by including this somewhere between your <head> tags:</p>

<div class="bwp-syntax-block clearfix">
<div class="bwp-syntax-toolbar"><div class="bwp-syntax-control"><a href="javascript:;" class="bwp-syntax-source-switch" title="View Source Code"></a></div></div>
<div class="bwp-syntax-wrapper clearfix bwp-syntax-simple"><table class="html4strict"><tbody><tr class="li1"><td class="ln"><pre class="de1">1
</pre></td><td class="de1"><pre class="de1"><span class="sc2">&lt;<span class="kw2">script</span> <span class="kw3">type</span><span class="sy0">=</span><span class="st0">&quot;text/javascript&quot;</span> <span class="kw3">src</span><span class="sy0">=</span><span class="st0">&quot;https://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js&quot;</span>&gt;&lt;<span class="sy0">/</span><span class="kw2">script</span>&gt;</span></pre></td></tr></tbody></table></div>
<div class="bwp-syntax-source"><pre class="no-parse">&lt;script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js"&gt;&lt;/script&gt;</pre></div></div>

<p>Now that we have included jQuery, we need the code to power our drop downs. Add this in just before your closing </body> tag:</p>

<div class="bwp-syntax-block clearfix">
<div class="bwp-syntax-toolbar"><div class="bwp-syntax-control"><a href="javascript:;" class="bwp-syntax-source-switch" title="View Source Code"></a></div></div>
<div class="bwp-syntax-wrapper clearfix bwp-syntax-simple"><table class="html4strict"><tbody><tr class="li1"><td class="ln"><pre class="de1">1
2
3
4
5
6
7
8
</pre></td><td class="de1"><pre class="de1"><span class="sc2">&lt;<span class="kw2">script</span> <span class="kw3">type</span><span class="sy0">=</span><span class="st0">&quot;text/javascript&quot;</span>&gt;</span>
&nbsp; &nbsp; $('#dd_menu &gt; li').hover(function() {
&nbsp; &nbsp; &nbsp; &nbsp; $('&gt; ul', this).toggle();
&nbsp; &nbsp; });
&nbsp; &nbsp; $('#dd_menu &gt; li &gt; ul &gt; li').hover(function() {
&nbsp; &nbsp; &nbsp; &nbsp; $('&gt; ul', this).toggle();
&nbsp; &nbsp; });
<span class="sc2">&lt;<span class="sy0">/</span><span class="kw2">script</span>&gt;</span></pre></td></tr></tbody></table></div>
<div class="bwp-syntax-source"><pre class="no-parse">&lt;script type="text/javascript"&gt;
	$('#dd_menu &gt; li').hover(function() {
		$('&gt; ul', this).toggle();
	});
	$('#dd_menu &gt; li &gt; ul &gt; li').hover(function() {
		$('&gt; ul', this).toggle();
	});
&lt;/script&gt;</pre></div></div>

<p>If you want fancy fade or slide effects, you could replace the references to toggle() with fadeToggle() or slideToggle(). Have a play around until you come up with something that you like.</p>
<h3>The CSS</h3>
<p>This part is entirely up to you; it&#8217;s your menu! Having said that, here&#8217;s some CSS that you&#8217;ll definitely need to add:</p>

<div class="bwp-syntax-block clearfix">
<div class="bwp-syntax-toolbar"><div class="bwp-syntax-control"><a href="javascript:;" class="bwp-syntax-source-switch" title="View Source Code"></a></div></div>
<div class="bwp-syntax-wrapper clearfix bwp-syntax-simple"><table class="css"><tbody><tr class="li1"><td class="ln"><pre class="de1">1
2
3
</pre></td><td class="de1"><pre class="de1"><span class="re0">#dd_menu</span> ul <span class="br0">&#123;</span>
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">display</span><span class="sy0">:</span> <span class="kw2">none</span><span class="sy0">;</span>
<span class="br0">&#125;</span></pre></td></tr></tbody></table></div>
<div class="bwp-syntax-source"><pre class="no-parse">#dd_menu ul {
		display: none;
}</pre></div></div>

<p>Without this, the full menu will display by default, which sort of defeats the point of a drop down menu.</p>
<p>To give you a starting point, here&#8217;s the CSS I used in my demo. Feel free to copy and modify it.</p>

<div class="bwp-syntax-block clearfix">
<div class="bwp-syntax-toolbar" style="right: 15px;" ><div class="bwp-syntax-control"><a href="javascript:;" class="bwp-syntax-source-switch" title="View Source Code"></a></div></div>
<div class="bwp-syntax-wrapper clearfix bwp-syntax-simple"style=" height: 252px;"><table class="css"><tbody><tr class="li1"><td class="ln"><pre class="de1">1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
</pre></td><td class="de1"><pre class="de1"><span class="re0">#dd_menu</span> <span class="br0">&#123;</span>
&nbsp; &nbsp; <span class="kw1">padding</span><span class="sy0">:</span> <span class="nu0">0</span><span class="sy0">;</span>
&nbsp; &nbsp; <span class="kw1">list-style</span><span class="sy0">:</span> <span class="kw2">none</span><span class="sy0">;</span>
&nbsp; &nbsp; <span class="kw1">overflow</span><span class="sy0">:</span> <span class="kw2">auto</span><span class="sy0">;</span>
&nbsp; &nbsp; <span class="kw1">text-align</span><span class="sy0">:</span> <span class="kw2">center</span><span class="sy0">;</span>
<span class="br0">&#125;</span>
&nbsp;
<span class="re0">#dd_menu</span> ul <span class="br0">&#123;</span>
&nbsp; &nbsp; <span class="kw1">display</span><span class="sy0">:</span> <span class="kw2">none</span><span class="sy0">;</span>
&nbsp; &nbsp; <span class="kw1">position</span><span class="sy0">:</span> <span class="kw2">absolute</span><span class="sy0">;</span>
&nbsp; &nbsp; <span class="kw1">background-color</span><span class="sy0">:</span> <span class="re0">#fff</span><span class="sy0">;</span>
&nbsp; &nbsp; <span class="kw1">border-width</span><span class="sy0">:</span> <span class="nu0">0</span> <span class="re3">1px</span> <span class="re3">1px</span> <span class="re3">1px</span><span class="sy0">;</span>
&nbsp; &nbsp; <span class="kw1">border-style</span><span class="sy0">:</span> <span class="kw2">solid</span><span class="sy0">;</span>
&nbsp; &nbsp; <span class="kw1">border-color</span><span class="sy0">:</span> <span class="kw2">red</span><span class="sy0">;</span>
&nbsp; &nbsp; <span class="kw1">padding</span><span class="sy0">:</span> <span class="nu0">0</span><span class="sy0">;</span>
&nbsp; &nbsp; <span class="kw1">list-style</span><span class="sy0">:</span> <span class="kw2">none</span><span class="sy0">;</span>
&nbsp; &nbsp; <span class="kw1">width</span><span class="sy0">:</span> <span class="re3">160px</span><span class="sy0">;</span>
<span class="br0">&#125;</span>
&nbsp;
<span class="re0">#dd_menu</span> ul li <span class="br0">&#123;</span>
&nbsp; &nbsp; <span class="kw1">background-color</span><span class="sy0">:</span> <span class="re0">#ccc</span><span class="sy0">;</span>
<span class="br0">&#125;</span>
&nbsp;
<span class="re0">#dd_menu</span> ul li<span class="re2">:hover </span><span class="br0">&#123;</span>
&nbsp; &nbsp; <span class="kw1">background-color</span><span class="sy0">:</span> <span class="re0">#fff</span><span class="sy0">;</span>
<span class="br0">&#125;</span>
&nbsp;
<span class="re0">#dd_menu</span> <span class="sy0">&gt;</span> li <span class="br0">&#123;</span>
&nbsp; &nbsp; <span class="kw1">float</span><span class="sy0">:</span> <span class="kw1">left</span><span class="sy0">;</span>
&nbsp; &nbsp; <span class="kw1">border</span><span class="sy0">:</span> <span class="re3">1px</span> <span class="kw2">solid</span> <span class="kw2">red</span><span class="sy0">;</span>
&nbsp; &nbsp; <span class="kw1">background-color</span><span class="sy0">:</span> <span class="re0">#ccc</span><span class="sy0">;</span>
&nbsp; &nbsp; <span class="kw1">height</span><span class="sy0">:</span> <span class="re3">30px</span><span class="sy0">;</span>
&nbsp; &nbsp; <span class="kw1">line-height</span><span class="sy0">:</span> <span class="re3">30px</span><span class="sy0">;</span>
<span class="br0">&#125;</span>
&nbsp;
<span class="re0">#dd_menu</span> li a <span class="br0">&#123;</span>
&nbsp; &nbsp; <span class="kw1">width</span><span class="sy0">:</span> <span class="re3">160px</span><span class="sy0">;</span>
&nbsp; &nbsp; <span class="kw1">display</span><span class="sy0">:</span> <span class="kw2">block</span><span class="sy0">;</span>
<span class="br0">&#125;</span>
&nbsp;
<span class="re0">#dd_menu</span> ul li ul <span class="br0">&#123;</span>
&nbsp; &nbsp; <span class="kw1">left</span><span class="sy0">:</span> <span class="re3">160px</span><span class="sy0">;</span>
&nbsp; &nbsp; <span class="kw1">margin-top</span><span class="sy0">:</span> <span class="re3">-30px</span><span class="sy0">;</span>
&nbsp; &nbsp; <span class="kw1">border-top-width</span><span class="sy0">:</span> <span class="re3">1px</span><span class="sy0">;</span>
&nbsp; &nbsp; <span class="kw1">width</span><span class="sy0">:</span> <span class="re3">160px</span><span class="sy0">;</span>
&nbsp; &nbsp; <span class="kw1">padding</span><span class="sy0">:</span> <span class="nu0">0</span><span class="sy0">;</span>
<span class="br0">&#125;</span></pre></td></tr></tbody></table></div>
<div class="bwp-syntax-source"><pre class="no-parse">#dd_menu {
	padding: 0;
	list-style: none;
	overflow: auto;
	text-align: center;
}

#dd_menu ul {
	display: none;
	position: absolute;
	background-color: #fff;
	border-width: 0 1px 1px 1px;
	border-style: solid;
	border-color: red;
	padding: 0;
	list-style: none;
	width: 160px;
}

#dd_menu ul li {
	background-color: #ccc;
}

#dd_menu ul li:hover {
	background-color: #fff;
}

#dd_menu &gt; li {
	float: left;
	border: 1px solid red;
	background-color: #ccc;
	height: 30px;
	line-height: 30px;
}

#dd_menu li a {
	width: 160px;
	display: block;
}

#dd_menu ul li ul {
	left: 160px;
	margin-top: -30px;
	border-top-width: 1px;
	width: 160px;
	padding: 0;
}</pre></div></div>

<h3>Why all the JavaScript?</h3>
<p>The demo at the start of this post can be achieved without any JavaScript. Try it yourself; strip out all the JavaScript, and then add this CSS:</p>

<div class="bwp-syntax-block clearfix">
<div class="bwp-syntax-toolbar"><div class="bwp-syntax-control"><a href="javascript:;" class="bwp-syntax-source-switch" title="View Source Code"></a></div></div>
<div class="bwp-syntax-wrapper clearfix bwp-syntax-simple"><table class="css"><tbody><tr class="li1"><td class="ln"><pre class="de1">1
2
3
4
5
6
7
</pre></td><td class="de1"><pre class="de1"><span class="re0">#dd_menu</span> <span class="sy0">&gt;</span> li<span class="re2">:hover </span><span class="sy0">&gt;</span> ul <span class="br0">&#123;</span>
&nbsp; &nbsp; <span class="kw1">display</span><span class="sy0">:</span> <span class="kw2">inline</span><span class="sy0">;</span>
<span class="br0">&#125;</span>
&nbsp;
<span class="re0">#dd_menu</span> <span class="sy0">&gt;</span> li <span class="sy0">&gt;</span> ul <span class="sy0">&gt;</span> li<span class="re2">:hover </span><span class="sy0">&gt;</span> ul <span class="br0">&#123;</span>
&nbsp; &nbsp; <span class="kw1">display</span><span class="sy0">:</span> <span class="kw2">inline</span><span class="sy0">;</span>
<span class="br0">&#125;</span></pre></td></tr></tbody></table></div>
<div class="bwp-syntax-source"><pre class="no-parse">#dd_menu &gt; li:hover &gt; ul {
	display: inline;
}

#dd_menu &gt; li &gt; ul &gt; li:hover &gt; ul {
	display: inline;
}</pre></div></div>

<p>It works the same as before! Why do we even bother with all the jQuery?</p>
<p>The goal of this post is to provide a starting point, to give you a basic structure upon which you can build. Using jQuery adds in the possibility to add simple effects like sliding, which will make your menu look a lot nicer than the demo above! If you&#8217;re happy without fancy effects and the like, then by all means copy in the additional CSS and leave it at that. Otherwise, use the jQuery code and get your hands dirty!</p>
<p>If you use this on your site, share the link in the comments. I&#8217;d love to see what you come up with.</p>
<p>The post <a href="http://gregdev.com.au/jquery/create-a-really-simple-multi-level-drop-down-menu/">Create a (really) simple multi level drop down menu</a> appeared first on <a href="http://gregdev.com.au">Greg Smith Mobile &amp; Web Developer</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://gregdev.com.au/jquery/create-a-really-simple-multi-level-drop-down-menu/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Automatically add a jQuery date picker to an input box with a specific class</title>
		<link>http://gregdev.com.au/jquery/automatically-add-a-jquery-date-picker-to-an-input-box-with-a-specific-class/</link>
		<comments>http://gregdev.com.au/jquery/automatically-add-a-jquery-date-picker-to-an-input-box-with-a-specific-class/#comments</comments>
		<pubDate>Fri, 13 May 2011 06:41:25 +0000</pubDate>
		<dc:creator>greg</dc:creator>
				<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://gregdev.net/?p=143</guid>
		<description><![CDATA[<p>The jQuery UI project comes packed with a nice little datepicker which you can add to a textbox field. Once you&#8217;ve included the jQuery and jQuery UI JavaScript files on your Web site, you need to add in some JavaScript to add the datepicker to a particular form element: 1 2 3 $&#40;function&#40;&#41; &#123; &#160; [...]</p><p>The post <a href="http://gregdev.com.au/jquery/automatically-add-a-jquery-date-picker-to-an-input-box-with-a-specific-class/">Automatically add a jQuery date picker to an input box with a specific class</a> appeared first on <a href="http://gregdev.com.au">Greg Smith Mobile &amp; Web Developer</a>.</p>]]></description>
				<content:encoded><![CDATA[<p>The jQuery UI project comes packed with a nice little datepicker which you can add to a textbox field.</p>
<p><img src="http://gregdev.com.au/wordpress/wp-content/uploads/datepicker.gif" alt="datepicker" class="alignnone size-full" /></p>
<p>Once you&#8217;ve included the jQuery and jQuery UI JavaScript files on your Web site, you need to add in some JavaScript to add the datepicker to a particular form element:</p>

<div class="bwp-syntax-block clearfix">
<div class="bwp-syntax-toolbar"><div class="bwp-syntax-control"><a href="javascript:;" class="bwp-syntax-source-switch" title="View Source Code"></a></div></div>
<div class="bwp-syntax-wrapper clearfix bwp-syntax-simple"><table class="javascript"><tbody><tr class="li1"><td class="ln"><pre class="de1">1
2
3
</pre></td><td class="de1"><pre class="de1">$<span class="br0">&#40;</span><span class="kw2">function</span><span class="br0">&#40;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span>
&nbsp; &nbsp; $<span class="br0">&#40;</span> <span class="st0">&quot;#datepicker&quot;</span> <span class="br0">&#41;</span>.<span class="me1">datepicker</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span>
<span class="br0">&#125;</span><span class="br0">&#41;</span><span class="sy0">;</span></pre></td></tr></tbody></table></div>
<div class="bwp-syntax-source"><pre class="no-parse">$(function() {
	$( "#datepicker" ).datepicker();
});</pre></div></div>

<p>If you plan to have multiple datepicker fields across your site, here&#8217;s a little snippet which you can use instead of the above code that will automatically add a datepicker to any textbox with the class &#8220;date&#8221;:</p>

<div class="bwp-syntax-block clearfix">
<div class="bwp-syntax-toolbar"><div class="bwp-syntax-control"><a href="javascript:;" class="bwp-syntax-source-switch" title="View Source Code"></a></div></div>
<div class="bwp-syntax-wrapper clearfix bwp-syntax-simple"><table class="javascript"><tbody><tr class="li1"><td class="ln"><pre class="de1">1
2
3
4
5
</pre></td><td class="de1"><pre class="de1">$<span class="br0">&#40;</span>document<span class="br0">&#41;</span>.<span class="me1">ready</span><span class="br0">&#40;</span><span class="kw2">function</span><span class="br0">&#40;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span>
&nbsp; &nbsp; $<span class="br0">&#40;</span><span class="st0">'.date'</span><span class="br0">&#41;</span>.<span class="me1">each</span><span class="br0">&#40;</span><span class="kw2">function</span><span class="br0">&#40;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span>
&nbsp; &nbsp; &nbsp; &nbsp; $<span class="br0">&#40;</span><span class="kw1">this</span><span class="br0">&#41;</span>.<span class="me1">datepicker</span><span class="br0">&#40;</span><span class="br0">&#123;</span> dateFormat<span class="sy0">:</span> <span class="st0">'yy-mm-dd'</span> <span class="br0">&#125;</span><span class="br0">&#41;</span><span class="sy0">;</span>
&nbsp; &nbsp; <span class="br0">&#125;</span><span class="br0">&#41;</span><span class="sy0">;</span>
<span class="br0">&#125;</span><span class="br0">&#41;</span><span class="sy0">;</span></pre></td></tr></tbody></table></div>
<div class="bwp-syntax-source"><pre class="no-parse">$(document).ready(function() {
	$('.date').each(function() {
		$(this).datepicker({ dateFormat: 'yy-mm-dd' });
	});
});</pre></div></div>

<p>Just add this code to your site footer, or into some globally-included JavaScript file, and then create your form element:</p>

<div class="bwp-syntax-block clearfix">
<div class="bwp-syntax-toolbar"><div class="bwp-syntax-control"><a href="javascript:;" class="bwp-syntax-source-switch" title="View Source Code"></a></div></div>
<div class="bwp-syntax-wrapper clearfix bwp-syntax-simple"><table class="html4strict"><tbody><tr class="li1"><td class="ln"><pre class="de1">1
</pre></td><td class="de1"><pre class="de1"><span class="sc2">&lt;<span class="kw2">input</span> <span class="kw3">type</span><span class="sy0">=</span><span class="st0">&quot;text&quot;</span> <span class="kw3">name</span><span class="sy0">=</span><span class="st0">&quot;date&quot;</span> <span class="kw3">class</span><span class="sy0">=</span><span class="st0">&quot;date&quot;</span> <span class="sy0">/</span>&gt;</span></pre></td></tr></tbody></table></div>
<div class="bwp-syntax-source"><pre class="no-parse">&lt;input type="text" name="date" class="date" /&gt;</pre></div></div>

<p>Create as many of these as you like; they&#8217;ll all be automatically converted into datepickers. Easy!</p>
<p>The post <a href="http://gregdev.com.au/jquery/automatically-add-a-jquery-date-picker-to-an-input-box-with-a-specific-class/">Automatically add a jQuery date picker to an input box with a specific class</a> appeared first on <a href="http://gregdev.com.au">Greg Smith Mobile &amp; Web Developer</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://gregdev.com.au/jquery/automatically-add-a-jquery-date-picker-to-an-input-box-with-a-specific-class/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WordPress: get subpages with get_pages() and meta_key</title>
		<link>http://gregdev.com.au/wordpress/wordpress-get-subpages-with-get_pages-and-meta_key/</link>
		<comments>http://gregdev.com.au/wordpress/wordpress-get-subpages-with-get_pages-and-meta_key/#comments</comments>
		<pubDate>Sat, 30 Apr 2011 02:56:00 +0000</pubDate>
		<dc:creator>greg</dc:creator>
				<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://gregdev.net/?p=128</guid>
		<description><![CDATA[<p>This one had me stumped for a while. I wanted to get a list of all pages which had a certain custom field. This can be easily done by passing the meta_key parameter to the get_pages() function, which returns an array of post objects. For example, if you wanted to get a list of all [...]</p><p>The post <a href="http://gregdev.com.au/wordpress/wordpress-get-subpages-with-get_pages-and-meta_key/">WordPress: get subpages with get_pages() and meta_key</a> appeared first on <a href="http://gregdev.com.au">Greg Smith Mobile &amp; Web Developer</a>.</p>]]></description>
				<content:encoded><![CDATA[<p>This one had me stumped for a while.</p>
<p>I wanted to get a list of all pages which had a certain custom field. This can be easily done by passing the <strong>meta_key</strong> parameter to the <a href="http://codex.wordpress.org/Function_Reference/get_pages">get_pages() function</a>, which returns an array of post objects. For example, if you wanted to get a list of all pages with the custom field &#8216;test&#8217;, you would do:</p>

<div class="bwp-syntax-block clearfix">
<div class="bwp-syntax-toolbar"><div class="bwp-syntax-control"><a href="javascript:;" class="bwp-syntax-source-switch" title="View Source Code"></a></div></div>
<div class="bwp-syntax-wrapper clearfix bwp-syntax-simple"><table class="php"><tbody><tr class="li1"><td class="ln"><pre class="de1">1
</pre></td><td class="de1"><pre class="de1"><span class="re0">$pages</span> <span class="sy0">=</span> get_pages<span class="br0">&#40;</span><span class="st_h">'meta_key=test'</span><span class="br0">&#41;</span><span class="sy0">;</span></pre></td></tr></tbody></table></div>
<div class="bwp-syntax-source"><pre class="no-parse">$pages = get_pages('meta_key=test');</pre></div></div>

<p>This works fine for top-level pages with the custom field &#8216;test&#8217;, but child pages are inexplicably ignored. This doesn&#8217;t seem to be mentioned anywhere in the WordPress Codex and was a source of much confusion to me.</p>
<h3>The solution: hierarchical</h3>
<p>Another parameter of the get_pages() function is <strong>hierarchical</strong>, which is used to display subpages in an indented fashion below their parent, and defaults to true. Setting this to false, we get our expected results from get_pages():</p>

<div class="bwp-syntax-block clearfix">
<div class="bwp-syntax-toolbar"><div class="bwp-syntax-control"><a href="javascript:;" class="bwp-syntax-source-switch" title="View Source Code"></a></div></div>
<div class="bwp-syntax-wrapper clearfix bwp-syntax-simple"><table class="php"><tbody><tr class="li1"><td class="ln"><pre class="de1">1
</pre></td><td class="de1"><pre class="de1"><span class="re0">$pages</span> <span class="sy0">=</span> get_pages<span class="br0">&#40;</span><span class="st_h">'meta_key=test&amp;hierarchical=0'</span><span class="br0">&#41;</span><span class="sy0">;</span></pre></td></tr></tbody></table></div>
<div class="bwp-syntax-source"><pre class="no-parse">$pages = get_pages('meta_key=test&amp;hierarchical=0');</pre></div></div>

<p>Any pages or subpages with the custom field &#8216;test&#8217; will now be returned.</p>
<p>The post <a href="http://gregdev.com.au/wordpress/wordpress-get-subpages-with-get_pages-and-meta_key/">WordPress: get subpages with get_pages() and meta_key</a> appeared first on <a href="http://gregdev.com.au">Greg Smith Mobile &amp; Web Developer</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://gregdev.com.au/wordpress/wordpress-get-subpages-with-get_pages-and-meta_key/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Rounded corners in Internet Explorer</title>
		<link>http://gregdev.com.au/browsers/rounded-corners-in-internet-explorer/</link>
		<comments>http://gregdev.com.au/browsers/rounded-corners-in-internet-explorer/#comments</comments>
		<pubDate>Tue, 13 Oct 2009 06:30:52 +0000</pubDate>
		<dc:creator>greg</dc:creator>
				<category><![CDATA[Browsers]]></category>
		<category><![CDATA[border]]></category>
		<category><![CDATA[border-radius]]></category>
		<category><![CDATA[internet explorer]]></category>
		<category><![CDATA[radius]]></category>
		<category><![CDATA[rounded corners]]></category>

		<guid isPermaLink="false">http://gregdev.net/?p=58</guid>
		<description><![CDATA[<p>I recently decided to recode a Web site I had developed several years ago to make it cleaner and easier to modify. The design involved lots of rounded corners and I had used images for some of the corners and CSS hacks for others. These methods did the job but made the markup somewhat bloated [...]</p><p>The post <a href="http://gregdev.com.au/browsers/rounded-corners-in-internet-explorer/">Rounded corners in Internet Explorer</a> appeared first on <a href="http://gregdev.com.au">Greg Smith Mobile &amp; Web Developer</a>.</p>]]></description>
				<content:encoded><![CDATA[<p>I recently decided to recode a Web site I had developed several years ago to make it cleaner and easier to modify. The design involved lots of rounded corners and I had used images for some of the corners and CSS hacks for others. These methods did the job but made the markup somewhat bloated and ugly, and the many images also increased the page download time.</p>
<p>CSS to the rescue! I decided to make use of the CSS3 border-radius property which allows for rounded corners without any images or extra HTML. CSS3 hasn&#8217;t been properly implemented yet, however the border-radius effect can be achieved in Gecko, Webkit and KHTML-based browsers using -moz-border-radius, -webkit-border-radius and -khtml-border-radius respectively. Opera&#8217;s Presto rendering engine had a similar property but this has unfortunately been removed. Opera&#8217;s market share (around 2%) is small enough that I can feel okay ignoring it until the developers choose to bring back the border-radius property. Internet Explorer, however, has a majority market share and predictably has no support for border-radius nor an equivalent proprietary property.</p>
<p>One of many solutions I found to Internet Explorer&#8217;s disability was a JavaScript solution, <a href="http://www.dillerdesign.com/experiment/DD_roundies/">DD_roundies</a>, by <a href="http://www.dillerdesign.com">Drew Diller</a>. Using conditional comments I included the reasonably small 9kb js file in my HTML source only for Internet Explorer users and added a rule for each ID or class that I wanted to have rounded corners for. Now when I load up my page in either IE 6, 7 or 8, the borders of the appropriate divs are as rounded as they are in Firefox.</p>
<p>The post <a href="http://gregdev.com.au/browsers/rounded-corners-in-internet-explorer/">Rounded corners in Internet Explorer</a> appeared first on <a href="http://gregdev.com.au">Greg Smith Mobile &amp; Web Developer</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://gregdev.com.au/browsers/rounded-corners-in-internet-explorer/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Left 4 Dead 2 banned in Australia</title>
		<link>http://gregdev.com.au/random/left-4-dead-2-banned-in-australia/</link>
		<comments>http://gregdev.com.au/random/left-4-dead-2-banned-in-australia/#comments</comments>
		<pubDate>Thu, 17 Sep 2009 04:01:57 +0000</pubDate>
		<dc:creator>greg</dc:creator>
				<category><![CDATA[Random]]></category>

		<guid isPermaLink="false">http://gregdev.net/?p=50</guid>
		<description><![CDATA[<p>It seems the OFLC has refused classification for Left 4 Dead 2. I agree with this decision; clearly anyone who plays this game will feel the urge to grab the nearest shotgun and blow the heads off a few zombies. This is further proof that our country is being run by a bunch of technologically-ignorant [...]</p><p>The post <a href="http://gregdev.com.au/random/left-4-dead-2-banned-in-australia/">Left 4 Dead 2 banned in Australia</a> appeared first on <a href="http://gregdev.com.au">Greg Smith Mobile &amp; Web Developer</a>.</p>]]></description>
				<content:encoded><![CDATA[<p>It seems the <a href="http://www.oflc.gov.au/www/cob/find.nsf/5b6ebdff7f5b9a24ca2575ca00062226/1ab758e7e649aa5eca257633005daca4!OpenDocument">OFLC has refused classification for Left 4 Dead 2</a>. I agree with this decision; clearly anyone who plays this game will feel the urge to grab the nearest shotgun and blow the heads off a few zombies.</p>
<p>This is further proof that our country is being run by a bunch of technologically-ignorant morons. Given the current proposals of Internet filtering and the complete lack of progress and planning of the National Broadband network we really didn&#8217;t need more evidence to support this.</p>
<p>So now instead of legally purchasing this game on Steam I will be forced to pirate it. If the Government thinks these outdated classification laws are protecting anyone they are seriously misinformed.</p>
<p>Thanks Michael Atkinson.</p>
<p>The post <a href="http://gregdev.com.au/random/left-4-dead-2-banned-in-australia/">Left 4 Dead 2 banned in Australia</a> appeared first on <a href="http://gregdev.com.au">Greg Smith Mobile &amp; Web Developer</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://gregdev.com.au/random/left-4-dead-2-banned-in-australia/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>What I hate about the iPhone</title>
		<link>http://gregdev.com.au/random/what-i-hate-about-the-iphone/</link>
		<comments>http://gregdev.com.au/random/what-i-hate-about-the-iphone/#comments</comments>
		<pubDate>Tue, 15 Sep 2009 01:32:34 +0000</pubDate>
		<dc:creator>greg</dc:creator>
				<category><![CDATA[Random]]></category>
		<category><![CDATA[annoyance]]></category>
		<category><![CDATA[App]]></category>
		<category><![CDATA[Apple]]></category>
		<category><![CDATA[apps]]></category>
		<category><![CDATA[iphone]]></category>
		<category><![CDATA[jailbreak]]></category>
		<category><![CDATA[touch screen]]></category>

		<guid isPermaLink="false">http://gregdev.net/?p=46</guid>
		<description><![CDATA[<p>A few months ago, despite not being the biggest Apple fan in the world, I bought an iPhone. Once again Apple had created something unique and I decided I had to have one. Being my first Apple product I was pretty impressed. Unfortunately my phone had a screen issue out of the box, but five [...]</p><p>The post <a href="http://gregdev.com.au/random/what-i-hate-about-the-iphone/">What I hate about the iPhone</a> appeared first on <a href="http://gregdev.com.au">Greg Smith Mobile &amp; Web Developer</a>.</p>]]></description>
				<content:encoded><![CDATA[<p>A few months ago, despite not being the biggest Apple fan in the world, I bought an iPhone. Once again Apple had created something unique and I decided I had to have one. Being my first Apple product I was pretty impressed. Unfortunately my phone had a screen issue out of the box, but five minutes on the phone to Apple and I was given a coupon to take to the post office to get it sent back for free. A week later I received a brand new iPhone (not a refurbished model) which was pretty good considering postage times from Adelaide to Sydney.</p>
<p>The iPhone itself is amazing. The touch screen is intuitive and easy to use and the App store is fantastic, there are so many different apps that are available for free (or for around a dollar or two, encouraging impulse buying).</p>
<p>But it&#8217;s Apple&#8217;s closed off nature that really lets down the iPhone. It didn&#8217;t take me long to jailbreak my phone, opening the door to additions like the awesomely useful SBSettings, the 5 icon dock, battery percentage indicator (I have the 3G model) and a whole bunch of other useful apps not available through official Apple channels. I will say this now: if you have an iPhone and it&#8217;s not jailbroken, do it now. You&#8217;ll be asking yourself why you didn&#8217;t do it sooner.</p>
<p>The biggest annoyance I&#8217;ve had so far with the restricted nature of Apps has been a usage meter I bought (paid app, not free, hence my anger over this issue). This particular App allows me to keep track of my mobile phone credit usage and home Internet download usage. I use this app at least once every two days. Unfortunately a couple of weeks back, Virgin Mobile Australia decided to redo their Web site and made changes to their authentication system. So now my usage app can no longer log into their site to get my mobile phone usage. The developer of the usage app, who is a legend for support, fixed the issue later that same day, but due to Apple&#8217;s infuriatingly slow approval process the update has yet to make an appearance in the App store, over two weeks later. If Apple must insist on approving all applications they will need to hire a hell of a lot more staff to do it, and should implement some sort of fast track program for application updates.</p>
<p>The second annoyance came about when I wanted to plug my iPhone into the TV. I went to the Apple Web site where they wanted $60 for a composite cable. That&#8217;s right, $60 for fifty cents worth of cable. &#8220;Screw that&#8221;, I thought, and went to have a look on eBay where I found generic iPhone-compatible composite cables for $10 with free postage. Unfortunately these listings have a small disclaimer: &#8220;will not work with iPhone firmware 3.0&#8243;. It seems that Apple has started including authentication chips in their cables, so if you plug a cable into an iPhone that doesn&#8217;t have one of these chips it will not work. These sort of business practices should be illegal and pretty much highlight Apple&#8217;s success: suck people into buying a really cool new toy and then squeeze more money out of them by charging ridiculous prices for accessories without allowing for competition.</p>
<p>Overall I am really happy with the iPhone and the above experiences have not made me rule out buying an iPhone again. Before I become an Apple &#8220;fanboy&#8221;, however, Apple are going to need to improve their business practices. But I don&#8217;t see that happening any time soon.</p>
<p>The post <a href="http://gregdev.com.au/random/what-i-hate-about-the-iphone/">What I hate about the iPhone</a> appeared first on <a href="http://gregdev.com.au">Greg Smith Mobile &amp; Web Developer</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://gregdev.com.au/random/what-i-hate-about-the-iphone/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Web filtering in Australia</title>
		<link>http://gregdev.com.au/the-web/web-filtering-in-australia/</link>
		<comments>http://gregdev.com.au/the-web/web-filtering-in-australia/#comments</comments>
		<pubDate>Fri, 08 May 2009 14:11:13 +0000</pubDate>
		<dc:creator>greg</dc:creator>
				<category><![CDATA[The Web]]></category>
		<category><![CDATA[australia]]></category>
		<category><![CDATA[content filter]]></category>
		<category><![CDATA[protecting children]]></category>
		<category><![CDATA[web filter]]></category>

		<guid isPermaLink="false">http://gregdev.net/?p=43</guid>
		<description><![CDATA[<p>Unless you&#8217;ve been living under a rock (or outside Australia) you&#8217;re likely well aware of the Australian Government&#8217;s plan to censor the Web. They want to force a compulsory ISP-side filter on every Australian in the name of the often used &#8220;won&#8217;t someone think of the children!&#8221; argument. There are two ways in which they [...]</p><p>The post <a href="http://gregdev.com.au/the-web/web-filtering-in-australia/">Web filtering in Australia</a> appeared first on <a href="http://gregdev.com.au">Greg Smith Mobile &amp; Web Developer</a>.</p>]]></description>
				<content:encoded><![CDATA[<p>Unless you&#8217;ve been living under a rock (or outside Australia) you&#8217;re likely well aware of the Australian Government&#8217;s plan to censor the Web. They want to force a compulsory ISP-side filter on every Australian in the name of the often used &#8220;won&#8217;t someone think of the children!&#8221; argument.</p>
<p>There are two ways in which they are protecting children by implementing a Web filter. The first is by blocking access to child pornography, the second is by preventing children from accidentally stumbling across inappropriate material.</p>
<h3>Blocking access to child pornography</h3>
<p>Simply put this is not possible. As surprising as this may sound, there is no official paedophile Web site out there. You can&#8217;t download images of child pornography by Googling &#8220;child porn&#8221; or going to childporn.com. All a Web filter is going to do is block access to certain Web sites, but what if the offending material isn&#8217;t on a Web site? The Web makes up only part of the Internet, there are dozens of other ways to transmit and share images. FTP, DCC via IRC and BitTorrent are just a few examples. Even if there were some inappropriate Web sites that should be blocked, bypassing any Web filter is insanely easy. Using a proxy, an SSH tunnel or an encrypted connection are all relatively easy ways to accomplish this.</p>
<h3>Preventing children from accidentally stumbling across inappropriate material</h3>
<p>Again, this sounds like a perfectly valid reason for implementing a Web filter. But why should the Web be filtered for <strong>every single Australian</strong> just to prevent kids from stumbling across something that they shouldn&#8217;t see? Surely an opt-in ISP-side filter, or a client-side filter installed by concerned parents, would accomplish this. Why doesn&#8217;t the Government simply require all ISPs to offer a free content filter for those who request it? And what ever happened to good old parental supervision? If you&#8217;re worried that your kids may, accidentally or not, stumble across something that&#8217;s inappropriate, keep an eye on them when they&#8217;re surfing. Put the family computer in an open location. Most kids are likely more technologically literate than their parents anyway, so bypassing the filter if they choose isn&#8217;t likely to be an issue: I remember using a proxy to bypass the draconian filters in high school when I was thirteen.</p>
<p>Web filters are not going to solve any problems and anyone who thinks they will are kidding themselves and have absolutely no idea how the Internet or World Wide Web work. So please, Misters Rudd and Conroy, abandon this pointless plan to filter my Web, I will just bypass it out of principle anyway.</p>
<p>The post <a href="http://gregdev.com.au/the-web/web-filtering-in-australia/">Web filtering in Australia</a> appeared first on <a href="http://gregdev.com.au">Greg Smith Mobile &amp; Web Developer</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://gregdev.com.au/the-web/web-filtering-in-australia/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>The evil Google brain</title>
		<link>http://gregdev.com.au/the-web/the-evil-google-brain/</link>
		<comments>http://gregdev.com.au/the-web/the-evil-google-brain/#comments</comments>
		<pubDate>Wed, 08 Apr 2009 00:22:43 +0000</pubDate>
		<dc:creator>greg</dc:creator>
				<category><![CDATA[The Web]]></category>
		<category><![CDATA[Google]]></category>

		<guid isPermaLink="false">http://gregdev.net/?p=39</guid>
		<description><![CDATA[<p>Google is starting to remind me of the evil flying brains from Futurama: once Google has collected and organized all the world&#8217;s information in their datacentre they will destroy Earth so that no new information can be created. It started with Google Earth: we could view satellite images of the entire planet, with enough detail [...]</p><p>The post <a href="http://gregdev.com.au/the-web/the-evil-google-brain/">The evil Google brain</a> appeared first on <a href="http://gregdev.com.au">Greg Smith Mobile &amp; Web Developer</a>.</p>]]></description>
				<content:encoded><![CDATA[<p>Google is starting to remind me of the evil flying brains from Futurama: once Google has collected and organized all the world&#8217;s information in their datacentre they will destroy Earth so that no new information can be created.</p>
<p>It started with Google Earth: we could view satellite images of the entire planet, with enough detail to see the tops of people&#8217;s heads. Then there was the slightly creepier Street View, which allowed us to see straight down people&#8217;s driveways and look at others as they walked down the street. The <a href="http://mashable.com/2009/04/06/google-health-prescriptions/">latest venture</a> seems to be sorting and organizing prescriptions.</p>
<p>What does everyone else think: a harmless company looking to make information easily accessible for all, or an alien race of super intelligent brains intent on learning everything until they destroy the Earth?</p>
<p>The post <a href="http://gregdev.com.au/the-web/the-evil-google-brain/">The evil Google brain</a> appeared first on <a href="http://gregdev.com.au">Greg Smith Mobile &amp; Web Developer</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://gregdev.com.au/the-web/the-evil-google-brain/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
