<?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>Codelab Blog &#187; JQuery</title>
	<atom:link href="http://blog.codelab.co.nz/tag/jquery/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.codelab.co.nz</link>
	<description>Technical Articles and News from Codelab Ltd</description>
	<lastBuildDate>Tue, 17 Jan 2012 13:10:43 +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>Setting the screen position when visiting previous page with jQuery</title>
		<link>http://blog.codelab.co.nz/2012/01/18/setting-the-screen-position-when-visiting-previous-page-with-jquery/</link>
		<comments>http://blog.codelab.co.nz/2012/01/18/setting-the-screen-position-when-visiting-previous-page-with-jquery/#comments</comments>
		<pubDate>Tue, 17 Jan 2012 13:10:43 +0000</pubDate>
		<dc:creator>Tim</dc:creator>
				<category><![CDATA[jQuery]]></category>
		<category><![CDATA[JQuery]]></category>
		<category><![CDATA[Open Source]]></category>

		<guid isPermaLink="false">http://blog.codelab.co.nz/?p=373</guid>
		<description><![CDATA[The scenario This problem came while I was working on a client’s website. Take this scenario. I have a listing page (similar to a listing page from www.trademe.co.nz or www.ascent.co.nz ). They have a lot of listings. Each listing has a hyperlink going to a detail page which describes more about each listing. If you [...]]]></description>
			<content:encoded><![CDATA[<p>The scenario</p>
<p>This problem came while I was working on a client’s website. Take this scenario. I have a listing page (similar to a listing page from <a title="TradeMe" href="http://www.trademe.co.nz" target="_blank">www.trademe.co.nz</a> or <a title="Ascent Technologies" href="http://www.ascent.co.nz " target="_blank">www.ascent.co.nz </a>). They have a lot of listings. Each listing has a hyperlink going to a detail page which describes more about each listing.<br />
If you have quite a large page of listings, the user has to scroll down the page to find the listing they want to click on. The problem is, when they click on the link and go to the details page, what happens when the click back and they end up back at the top of the page again? This can be quite annoying. It would be “nice” to get the browser to go back to the previous position on the listing page.</p>
<p>The Approach</p>
<p>We achieve this but attach a click event handler to the specific a tags that we want to record the last clicked position from the user before we redirect to the next page. This means when the user goes back to the previous page they will be taken to the exact position on the page. When the click event happens we always override what was in the cookie so that we don’t end up with several pages and positions. We don’t want a user to go to another page they have been to before and set the scroll position, it should only happen to the previous page.</p>
<p>Here is the code</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:300px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">var COOKIE_NAME = &quot;scroll&quot;;<br />
&nbsp;<br />
$(document).ready(function () {<br />
&nbsp; &nbsp; // Check to see if the user already has the cookie set to scroll<br />
&nbsp; &nbsp; var scrollPosition = getCookiePosition(COOKIE_NAME);<br />
&nbsp; &nbsp; if (scrollPosition.length &gt; 0) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; // Scroll to the position of the last link clicked<br />
&nbsp; &nbsp; &nbsp; &nbsp; window.scrollTo(0, parseInt(scrollPosition, 10));<br />
&nbsp; &nbsp; }<br />
&nbsp;<br />
&nbsp; &nbsp; // Attach an overriding click event for each link <br />
&nbsp; &nbsp; // saveScrollPosition function can be called before the user is redirected.<br />
&nbsp; &nbsp; $(&quot;a.savel&quot;).each(function () {<br />
&nbsp; &nbsp; &nbsp; &nbsp; $(this).click(function () {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; saveScrollPosition($(this));<br />
&nbsp; &nbsp; &nbsp; &nbsp; });<br />
&nbsp; &nbsp; });<br />
});<br />
&nbsp;<br />
// Get the offset (height from top of page and the current page url) of the link element<br />
// and save it in a cookie.<br />
function saveScrollPosition(link) {<br />
&nbsp; &nbsp; var linkTop = link.offset().top;<br />
&nbsp; &nbsp; setCookie(COOKIE_NAME, &quot;pos=&quot; + linkTop + &quot;&amp;link=&quot; + escape(window.location.pathname), 1);<br />
}<br />
&nbsp;<br />
//Trim whitespaces<br />
function trim(str) {<br />
&nbsp; &nbsp;return str.replace(/^\s+|\s+$/g, '');<br />
} <br />
// Get cookie helper function<br />
function getCookiePosition(name) {<br />
&nbsp; &nbsp; if (document.cookie.length &gt; 0) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; //Get the right cookie<br />
&nbsp; &nbsp; &nbsp; &nbsp; var cookies = document.cookie.split(&quot;;&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; for (var i = 0; i &lt; cookies.length; i++) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (trim(cookies[i].split(&quot;=&quot;)[0]) == COOKIE_NAME) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //Get the position of the &amp; sign<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; var pos = cookies[i].indexOf(&quot;&amp;&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (pos &gt; -1) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //Get value<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; var scrollValue = cookies[i].split(&quot;=&quot;)[2].substring(0, cookies[i].split(&quot;=&quot;)[2].indexOf(&quot;&amp;&quot;));<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; var link = unescape(trim(cookies[i].split(&quot;=&quot;)[3]));<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //if the link is the same as the current page, then assume user wants to go back to the same position<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (link == window.location.pathname) return scrollValue;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return &quot;&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; return &quot;&quot;;<br />
&nbsp; &nbsp; }<br />
&nbsp; &nbsp; return &quot;&quot;;<br />
}<br />
&nbsp;<br />
//Method to create a new cookie<br />
function createCookie(name, value, days) {<br />
&nbsp; &nbsp; if (days) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; var date = new Date();<br />
&nbsp; &nbsp; &nbsp; &nbsp; date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));<br />
&nbsp; &nbsp; &nbsp; &nbsp; var expires = &quot;; expires=&quot; + date.toGMTString();<br />
&nbsp; &nbsp; }<br />
&nbsp; &nbsp; else var expires = &quot;&quot;;<br />
&nbsp; &nbsp; document.cookie = name + &quot;=&quot; + value + expires + &quot;; path=/&quot;;<br />
}<br />
&nbsp;<br />
// Set cookie<br />
function setCookie(name, value, expiredays) {<br />
&nbsp; &nbsp; //Remove all other cookies<br />
&nbsp; &nbsp; var cookies = document.cookie.split(&quot;;&quot;);<br />
&nbsp; &nbsp; for (var i = 0; i &lt; cookies.length; i++) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; if (trim(cookies[i].split(&quot;=&quot;)[0]) == COOKIE_NAME) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; createCookie(trim(cookies[i].split(&quot;=&quot;)[0]), &quot;&quot;, -1);<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; }<br />
&nbsp; &nbsp; //Set the new cookie<br />
&nbsp; &nbsp; createCookie(name, value, expiredays);<br />
}</div></div>
]]></content:encoded>
			<wfw:commentRss>http://blog.codelab.co.nz/2012/01/18/setting-the-screen-position-when-visiting-previous-page-with-jquery/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Perform ASP.NET Postback using JQuery</title>
		<link>http://blog.codelab.co.nz/2011/10/27/perform-asp-net-postback-using-jquery/</link>
		<comments>http://blog.codelab.co.nz/2011/10/27/perform-asp-net-postback-using-jquery/#comments</comments>
		<pubDate>Wed, 26 Oct 2011 23:47:24 +0000</pubDate>
		<dc:creator>Tim</dc:creator>
				<category><![CDATA[.NET Framework]]></category>
		<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[.NET]]></category>
		<category><![CDATA[JQuery]]></category>
		<category><![CDATA[ViewState]]></category>

		<guid isPermaLink="false">http://blog.codelab.co.nz/?p=363</guid>
		<description><![CDATA[Came across a situation where I needed to disable the ASP.NET button using JQuery when the user clicks on the button, this is so we stop the user from clicking the button twice while the page is doing a postback. Firstly, add the following JQuery/Javascript code: &#60;script&#62; &#160;function autoSubmit() &#160;{ &#160;&#60;%= ClientScript.GetPostBackEventReference(btnSaveChanges, &#34;&#34;) %&#62;; &#160;} [...]]]></description>
			<content:encoded><![CDATA[<p>Came across a situation where I needed to disable the ASP.NET button using JQuery when the user clicks on the button, this is so we stop the user from clicking the button twice while the page is doing a postback.</p>
<p>Firstly, add the following JQuery/Javascript code:</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&lt;script&gt;<br />
<br />
&nbsp;function autoSubmit()<br />
&nbsp;{<br />
&nbsp;&lt;%= ClientScript.GetPostBackEventReference(btnSaveChanges, &quot;&quot;) %&gt;;<br />
&nbsp;}<br />
&nbsp; &nbsp; &nbsp;$(function () {<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;$(&quot;#&lt;%= btnSaveChanges.ClientID %&gt;&quot;).click(function () {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;$(this).attr(&quot;disabled&quot;, &quot;true&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;autoSubmit();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;return false;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;});<br />
&nbsp; &nbsp; &nbsp;});<br />
&lt;/script&gt;</div></div>
<p>You can inject the correct generated javascript code from using the function GetPostBackEventReference between the server tags.   Bind a click event to the ASP.NET server control which disables the button and call the autosubmit javascript function to perform a post back on the ASP.NET button control.   </p>
<p>References</p>
<p><a href="http://msdn.microsoft.com/en-us/library/ms153112.aspx" target="_blank">http://msdn.microsoft.com/en-us/library/ms153112.aspx</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.codelab.co.nz/2011/10/27/perform-asp-net-postback-using-jquery/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Max number of words in textarea using jQuery</title>
		<link>http://blog.codelab.co.nz/2011/06/07/max-number-of-words-in-textarea-using-jquery/</link>
		<comments>http://blog.codelab.co.nz/2011/06/07/max-number-of-words-in-textarea-using-jquery/#comments</comments>
		<pubDate>Tue, 07 Jun 2011 00:23:30 +0000</pubDate>
		<dc:creator>Tim</dc:creator>
				<category><![CDATA[jQuery]]></category>
		<category><![CDATA[JQuery]]></category>

		<guid isPermaLink="false">http://blog.codelab.co.nz/?p=345</guid>
		<description><![CDATA[Here is a little code snippet to set a maximum of words in a text area element. This could be turned into a jQuery function or refactored to be better reused, but there is a sample just to get you going. $('textarea').keyup(function () { &#160; &#160; &#160; &#160; &#160; &#160; var wordArray = this.value.split(/[\s\.\?]+/); //Split [...]]]></description>
			<content:encoded><![CDATA[<p>Here is a little code snippet to set a maximum of words in a text area element.</p>
<p>This could be turned into a jQuery function or refactored to be better reused, but there is a sample just to get you going.</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$('textarea').keyup(function () {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; var wordArray = this.value.split(/[\s\.\?]+/); //Split based on regular expression for spaces<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; var maxWords = 5; //max number of words<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; var total_words = wordArray.length; //current total of words<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; var newString = &quot;&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //Roll back the textarea value with the words that it had previously before the maximum was reached<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (total_words &gt; maxWords+1) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;for (var i = 0; i &lt; maxWords; i++) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; newString += wordArray[i] + &quot; &quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; this.value = newString;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; });</div></div>
]]></content:encoded>
			<wfw:commentRss>http://blog.codelab.co.nz/2011/06/07/max-number-of-words-in-textarea-using-jquery/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>JQuery 1.6+ attr and prop issue</title>
		<link>http://blog.codelab.co.nz/2011/05/16/jquery-1-6-attr-and-prop-issue/</link>
		<comments>http://blog.codelab.co.nz/2011/05/16/jquery-1-6-attr-and-prop-issue/#comments</comments>
		<pubDate>Mon, 16 May 2011 00:19:54 +0000</pubDate>
		<dc:creator>Tim</dc:creator>
				<category><![CDATA[jQuery]]></category>
		<category><![CDATA[JQuery]]></category>

		<guid isPermaLink="false">http://blog.codelab.co.nz/?p=337</guid>
		<description><![CDATA[I used the following code to make sure all radio buttons where unchecked and the current one was set correctly. This worked well before jQuery 1.6. $(document).ready(function() { SetUniqueRadioButton = function(current, id) { jQuery(&#34;input[type=radio]&#34;).each(function() { $(this).attr(&#34;checked&#34;, false); }); current.checked = true; }; }); Since jQuery 1.6, this code did not work and after doing some [...]]]></description>
			<content:encoded><![CDATA[<p>I used the following code to make sure all radio buttons where unchecked and the current one was set correctly.  This worked well before jQuery 1.6.</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$(document).ready(function() {<br />
SetUniqueRadioButton = function(current, id) {<br />
jQuery(&quot;input[type=radio]&quot;).each(function() {<br />
$(this).attr(&quot;checked&quot;, false);<br />
});<br />
current.checked = true;<br />
};<br />
});</div></div>
<p>Since jQuery 1.6, this code did not work and after doing some digging around, I found that you need to use the new method .prop() to get the code functioning correctly again.</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$(document).ready(function() {<br />
SetUniqueRadioButton = function(current, id) {<br />
jQuery(&quot;input[type=radio]&quot;).each(function() {<br />
$(this).prop(&quot;checked&quot;, false);<br />
});<br />
current.checked = true;<br />
};<br />
});</div></div>
<blockquote><p>Before jQuery 1.6, the .attr() method sometimes took property values into account when retrieving some attributes, which could cause inconsistent behavior. As of jQuery 1.6, the .prop() method provides a way to explicitly retrieve property values, while .attr() only retrieves attributes.</p></blockquote>
<p><em><strong>References:</strong></em></p>
<p><a href="http://api.jquery.com/prop/" target="_blank">http://api.jquery.com/prop/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.codelab.co.nz/2011/05/16/jquery-1-6-attr-and-prop-issue/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>handling multiple submit buttons in one form (asp.net webforms)</title>
		<link>http://blog.codelab.co.nz/2011/05/06/handling-multiple-submit-buttons/</link>
		<comments>http://blog.codelab.co.nz/2011/05/06/handling-multiple-submit-buttons/#comments</comments>
		<pubDate>Fri, 06 May 2011 05:00:03 +0000</pubDate>
		<dc:creator>Tim</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[ASP.NET MVC]]></category>
		<category><![CDATA[JQuery]]></category>
		<category><![CDATA[W3C]]></category>

		<guid isPermaLink="false">http://blog.codelab.co.nz/?p=325</guid>
		<description><![CDATA[I came across an issue where I had the following setup with an asp.net website: I had a master page with one main form element I had a submit button in the master page which acts as a search button across the website I had a login page that also has a submit button Naturally [...]]]></description>
			<content:encoded><![CDATA[<p>I came across an issue where I had the following setup with an asp.net website:</p>
<ol>
<li>I had a master page with one main form element</li>
<li>I had a submit button in the master page which acts as a search button across the website</li>
<li>I had a login page that also has a submit button</li>
</ol>
<p>Naturally when the user presses the enter key, it naturally takes the first submit button on the webpage as being the default submit button.   Therefore when a user enters their credentials on the login page, they will always be taken to the search page which is defined by the input button on the master page.</p>
<p>I used jQuery to help solve this issue, you need to do two important things:</p>
<p>1) You need to set a default selector on the input button you want to submit, i.e on the login button I put:</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp;&lt;input class=&quot;buttondefault&quot; name=&quot;myButton&quot; type=&quot;submit&quot; /&gt;</div></div>
<p>&nbsp;</p>
<p>2) Use the following code (Note this code can easily be refactored to be more efficient):</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$(&quot;form input&quot;).keypress(function (e) {<br />
if ((e.which &amp;&amp; e.which == 13) || (e.keyCode &amp;&amp; e.keyCode == 13)) {<br />
//if the search has text then submit that button first<br />
if ($('.buttondefault').length &gt; 0) {<br />
$('.buttondefault').click();<br />
return false;<br />
}<br />
$('#myMasterButtonClass input[type=submit]').click();<br />
return false;<br />
} else {<br />
return true;<br />
}<br />
});</div></div>
]]></content:encoded>
			<wfw:commentRss>http://blog.codelab.co.nz/2011/05/06/handling-multiple-submit-buttons/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>www.checkoutchristchurch.co.nz live!</title>
		<link>http://blog.codelab.co.nz/2009/12/15/www-checkoutchristchurch-co-nz-live/</link>
		<comments>http://blog.codelab.co.nz/2009/12/15/www-checkoutchristchurch-co-nz-live/#comments</comments>
		<pubDate>Mon, 14 Dec 2009 23:40:25 +0000</pubDate>
		<dc:creator>Tim</dc:creator>
				<category><![CDATA[News]]></category>
		<category><![CDATA[JQuery]]></category>

		<guid isPermaLink="false">http://blog.codelab.co.nz/?p=158</guid>
		<description><![CDATA[www.checkoutchristchurch.co.nz is now live!  this site loads in my personal photos of christchurch from flickr and loads in my tweets + all tweets that have the keyword &#8220;christchurch&#8221;. It uses jquery for scrolling through the thumbnails using your mouse wheel and various jquery plugins for twitter and flickr. Check it out! List of JQuer plugins [...]]]></description>
			<content:encoded><![CDATA[<p><a href="www.checkoutchristchurch.co.nz">www.checkoutchristchurch.co.nz</a> is now live!  this site loads in my personal photos of christchurch from flickr and loads in my tweets + all tweets that have the keyword &#8220;christchurch&#8221;.</p>
<p>It uses jquery for scrolling through the thumbnails using your mouse wheel and various jquery plugins for twitter and flickr.</p>
<p>Check it out!</p>
<p>List of JQuer plugins used:</p>
<p>jQuery Flickr &#8211; jQuery plug-in</p>
<p>jQuery mousewheel plugin</p>
<p>jQuery Twitter plugin</p>
<p>jCarouselLite image slider</p>
<p>Also, try out <a href="www.timarucity.co.nz">www.timarucity.co.nz</a> which was setup by <a href="http://www.verb.co.nz">Verb</a>..thanks to Verb for allowing me to share this idea.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.codelab.co.nz/2009/12/15/www-checkoutchristchurch-co-nz-live/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Limiting the number of text in textarea using JQuery</title>
		<link>http://blog.codelab.co.nz/2009/05/20/limiting-the-number-of-text-in-textarea-using-jquery/</link>
		<comments>http://blog.codelab.co.nz/2009/05/20/limiting-the-number-of-text-in-textarea-using-jquery/#comments</comments>
		<pubDate>Wed, 20 May 2009 01:51:06 +0000</pubDate>
		<dc:creator>Tim</dc:creator>
				<category><![CDATA[Open Source]]></category>
		<category><![CDATA[JQuery]]></category>

		<guid isPermaLink="false">http://blog.codelab.co.nz/?p=131</guid>
		<description><![CDATA[example: &#60;textarea id=&#8221;id&#8221; maxlength=&#8221;255&#8243;&#62;&#60;/textarea&#62; jQuery(&#8216;textarea[maxlength]&#8216;).keyup(function() { var max = parseInt(jQuery(this).attr(&#8216;maxlength&#8217;)); if (jQuery(this).val().length &#62; max) { jQuery(this).val(jQuery(this).val().substr(0, jQuery(this).attr(&#8216;maxlength&#8217;))); } if (jQuery(this).parent().find(&#8216;.charsRemaining&#8217;).length &#62; 0) jQuery(this).parent().find(&#8216;.charsRemaining&#8217;).html(&#8216;You have &#8216; + (max &#8211; jQuery(this).val().length) + &#8216; characters remaining&#8217;); else jQuery(this).parent().append(&#8216;&#60;div class=&#8221;charsRemaining&#8221;&#62;You have &#8216; + (max &#8211; jQuery(this).val().length) + &#8216; characters remaining&#60;/div&#62;&#8217;); });]]></description>
			<content:encoded><![CDATA[<p>example: &lt;textarea id=&#8221;id&#8221; maxlength=&#8221;255&#8243;&gt;&lt;/textarea&gt;</p>
<p>jQuery(&#8216;textarea[maxlength]&#8216;).keyup(function() {<br />
var max = parseInt(jQuery(this).attr(&#8216;maxlength&#8217;));<br />
if (jQuery(this).val().length &gt; max) {<br />
jQuery(this).val(jQuery(this).val().substr(0, jQuery(this).attr(&#8216;maxlength&#8217;)));<br />
}<br />
if (jQuery(this).parent().find(&#8216;.charsRemaining&#8217;).length &gt; 0) jQuery(this).parent().find(&#8216;.charsRemaining&#8217;).html(&#8216;You have &#8216; + (max &#8211; jQuery(this).val().length) + &#8216; characters remaining&#8217;);<br />
else jQuery(this).parent().append(&#8216;&lt;div class=&#8221;charsRemaining&#8221;&gt;You have &#8216; + (max &#8211; jQuery(this).val().length) + &#8216; characters remaining&lt;/div&gt;&#8217;);</p>
<p>});</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.codelab.co.nz/2009/05/20/limiting-the-number-of-text-in-textarea-using-jquery/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>JQuery Event Delegation</title>
		<link>http://blog.codelab.co.nz/2009/03/03/jquery-event-delegation/</link>
		<comments>http://blog.codelab.co.nz/2009/03/03/jquery-event-delegation/#comments</comments>
		<pubDate>Tue, 03 Mar 2009 01:41:49 +0000</pubDate>
		<dc:creator>Tim</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[JQuery]]></category>

		<guid isPermaLink="false">http://blog.codelab.co.nz/?p=87</guid>
		<description><![CDATA[Came across a awesome way of handling events using JQuery&#8217;s event delegation methods.   I have a list of A tags grouped in a table, and each A tag will call a method and pass a ID based on a value in the same column of that A tag. jQuery(&#8220;#tableId&#8221;).click(function(event) { var $target = jQuery(event.target), target [...]]]></description>
			<content:encoded><![CDATA[<p>Came across a awesome way of handling events using JQuery&#8217;s event delegation methods.   I have a list of A tags grouped in a table, and each A tag will call a method and pass a ID based on a value in the same column of that A tag.</p>
<p>jQuery(&#8220;#tableId&#8221;).click(function(event) {<br />
var $target = jQuery(event.target), target = event.target;<br />
if ($target.parents(&#8220;a:first&#8221;).is(&#8220;a.editNote&#8221;)) { //Make sure that we have found the right A tag<br />
var id = parseInt($target.parents(&#8220;tr:first&#8221;).find(&#8220;td:first a&#8221;).text()); //traverse back through the parents to view the corresponding ID which is in another A tag<br />
callFunction(id);<br />
}<br />
});</p>
<p>This is way better than doing a typical jQuery(&#8220;a[id=editNote"].click(function) as this creates a event handler for each A tag.   Using Event Delegation like above only creates one handler which has less overhead on browsers (especially IE).</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.codelab.co.nz/2009/03/03/jquery-event-delegation/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

