<?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>Alex's  Rocket &#187; jQuery</title>
	<atom:link href="http://klalex.com/category/jquery/feed/" rel="self" type="application/rss+xml" />
	<link>http://klalex.com</link>
	<description>Developing web applications, startups, technologies</description>
	<lastBuildDate>Tue, 21 Jun 2011 13:45:30 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Bug with Broken Ordered list in IE9</title>
		<link>http://klalex.com/2011/06/broken-ordered-list-in-ie9/</link>
		<comments>http://klalex.com/2011/06/broken-ordered-list-in-ie9/#comments</comments>
		<pubDate>Sat, 11 Jun 2011 12:19:31 +0000</pubDate>
		<dc:creator>klalex</dc:creator>
				<category><![CDATA[HTML]]></category>
		<category><![CDATA[IE9]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[bug]]></category>
		<category><![CDATA[hide]]></category>
		<category><![CDATA[issue]]></category>
		<category><![CDATA[ol]]></category>
		<category><![CDATA[ordered list]]></category>
		<category><![CDATA[show]]></category>
		<category><![CDATA[zero]]></category>

		<guid isPermaLink="false">http://klalex.com/?p=105</guid>
		<description><![CDATA[Recently I&#8217;ve been working with ordered lists. And found strange behavior in IE9 when one ordered list is hiding and new one is showing &#8211; instead of usual order 1,2,3.. it showed all zeros. And it actually doesn&#8217;t matter what list style type you choose &#8211; decimal, lower alpha or other. Let me show you [...]]]></description>
			<content:encoded><![CDATA[<p><P>Recently I&#8217;ve been working with ordered lists. And found strange behavior in IE9 when one ordered list is hiding and new one is showing &#8211; instead of usual order 1,2,3.. it showed all zeros. And it actually doesn&#8217;t matter what list style type you choose &#8211; decimal, lower alpha or other.</p>
<p>Let me show you an example in case you do not have the same problem as well on your project:</p>
<div class="codesnip-container" >
<div class="html4strict codesnip" style="font-family:monospace;"><span class="sc2">&lt;<a href="http://december.com/html/4/element/html.html"><span class="kw2">html</span></a>&gt;</span><br />
<span class="sc2">&lt;<a href="http://december.com/html/4/element/head.html"><span class="kw2">head</span></a>&gt;</span><br />
<span class="sc2">&lt;<a href="http://december.com/html/4/element/script.html"><span class="kw2">script</span></a> <span class="kw3">type</span><span class="sy0">=</span><span class="st0">&quot;text/javascript&quot;</span>&gt;</span><br />
window.onload = function() {<br />
&nbsp; &nbsp; &nbsp; &nbsp; document.getElementById(&#8216;lnk-one&#8217;).onclick = function() {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; document.getElementById(&#8216;two&#8217;).style.display = &#8216;none&#8217;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; document.getElementById(&#8216;one&#8217;).style.display = &#8216;block&#8217;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; };<br />
&nbsp; &nbsp; &nbsp; &nbsp; document.getElementById(&#8216;lnk-two&#8217;).onclick = function() {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; document.getElementById(&#8216;one&#8217;).style.display = &#8216;none&#8217;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; document.getElementById(&#8216;two&#8217;).style.display = &#8216;block&#8217;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; };<br />
}<br />
<span class="sc2">&lt;<span class="sy0">/</span><a href="http://december.com/html/4/element/script.html"><span class="kw2">script</span></a>&gt;</span><br />
<span class="sc2">&lt;<span class="sy0">/</span><a href="http://december.com/html/4/element/head.html"><span class="kw2">head</span></a>&gt;</span><br />
<span class="sc2">&lt;<a href="http://december.com/html/4/element/body.html"><span class="kw2">body</span></a>&gt;</span><br />
<span class="sc2">&lt;<a href="http://december.com/html/4/element/a.html"><span class="kw2">a</span></a> <span class="kw3">href</span><span class="sy0">=</span><span class="st0">&quot;#&quot;</span> <span class="kw3">id</span><span class="sy0">=</span><span class="st0">&quot;lnk-one&quot;</span>&gt;</span>One<span class="sc2">&lt;<span class="sy0">/</span><a href="http://december.com/html/4/element/a.html"><span class="kw2">a</span></a>&gt;</span> <span class="sc2">&lt;<a href="http://december.com/html/4/element/a.html"><span class="kw2">a</span></a> <span class="kw3">href</span><span class="sy0">=</span><span class="st0">&quot;#&quot;</span> <span class="kw3">id</span><span class="sy0">=</span><span class="st0">&quot;lnk-two&quot;</span>&gt;</span>Two<span class="sc2">&lt;<span class="sy0">/</span><a href="http://december.com/html/4/element/a.html"><span class="kw2">a</span></a>&gt;</span><br />
<span class="sc2">&lt;<a href="http://december.com/html/4/element/div.html"><span class="kw2">div</span></a> <span class="kw3">id</span><span class="sy0">=</span><span class="st0">&quot;one&quot;</span>&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="sc2">&lt;<a href="http://december.com/html/4/element/ol.html"><span class="kw2">ol</span></a>&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="sc2">&lt;<a href="http://december.com/html/4/element/li.html"><span class="kw2">li</span></a>&gt;</span>one<span class="sc2">&lt;<span class="sy0">/</span><a href="http://december.com/html/4/element/li.html"><span class="kw2">li</span></a>&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="sc2">&lt;<a href="http://december.com/html/4/element/li.html"><span class="kw2">li</span></a>&gt;</span>two<span class="sc2">&lt;<span class="sy0">/</span><a href="http://december.com/html/4/element/li.html"><span class="kw2">li</span></a>&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="sc2">&lt;<span class="sy0">/</span><a href="http://december.com/html/4/element/ol.html"><span class="kw2">ol</span></a>&gt;</span><br />
<span class="sc2">&lt;<span class="sy0">/</span><a href="http://december.com/html/4/element/div.html"><span class="kw2">div</span></a>&gt;</span><br />
<span class="sc2">&lt;<a href="http://december.com/html/4/element/div.html"><span class="kw2">div</span></a> <span class="kw3">id</span><span class="sy0">=</span><span class="st0">&quot;two&quot;</span> <span class="kw3">style</span><span class="sy0">=</span><span class="st0">&quot;display:none&quot;</span>&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="sc2">&lt;<a href="http://december.com/html/4/element/ol.html"><span class="kw2">ol</span></a>&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="sc2">&lt;<a href="http://december.com/html/4/element/li.html"><span class="kw2">li</span></a>&gt;</span>three<span class="sc2">&lt;<span class="sy0">/</span><a href="http://december.com/html/4/element/li.html"><span class="kw2">li</span></a>&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="sc2">&lt;<a href="http://december.com/html/4/element/li.html"><span class="kw2">li</span></a>&gt;</span>four<span class="sc2">&lt;<span class="sy0">/</span><a href="http://december.com/html/4/element/li.html"><span class="kw2">li</span></a>&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="sc2">&lt;<span class="sy0">/</span><a href="http://december.com/html/4/element/ol.html"><span class="kw2">ol</span></a>&gt;</span><br />
<span class="sc2">&lt;<span class="sy0">/</span><a href="http://december.com/html/4/element/div.html"><span class="kw2">div</span></a>&gt;</span><br />
<span class="sc2">&lt;<span class="sy0">/</span><a href="http://december.com/html/4/element/body.html"><span class="kw2">body</span></a>&gt;</span><br />
<span class="sc2">&lt;<span class="sy0">/</span><a href="http://december.com/html/4/element/html.html"><span class="kw2">html</span></a>&gt;</span></div>
</div>
<p>If you open this HTML in IE9 and then click at first on &#8220;Two&#8221; link and then &#8220;One&#8221; you will see the issue:</p>
<p><img alt="" src="http://www.klalex.com/wp-content/uploads/ordered_list_ie9.png" title="Ordered Lists in IE9 issue" class="aligncenter" width="175" height="144" /></p>
<p>Looks like order breaks in IE9 when one order is hidding then appears new one and then previous one is showing again. To quickly fix you need to place empty element say &lt;div&gt; in the end of the body and when you show ordered list just assing space to this element inner html. Here you are previous html page fixed:</p>
<div class="codesnip-container" >
<div class="html4strict codesnip" style="font-family:monospace;"><span class="sc2">&lt;<a href="http://december.com/html/4/element/html.html"><span class="kw2">html</span></a>&gt;</span><br />
<span class="sc2">&lt;<a href="http://december.com/html/4/element/head.html"><span class="kw2">head</span></a>&gt;</span><br />
<span class="sc2">&lt;<a href="http://december.com/html/4/element/script.html"><span class="kw2">script</span></a> <span class="kw3">type</span><span class="sy0">=</span><span class="st0">&quot;text/javascript&quot;</span>&gt;</span><br />
window.onload = function() {<br />
&nbsp; &nbsp; &nbsp; &nbsp; document.getElementById(&#8216;lnk-one&#8217;).onclick = function() {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; document.getElementById(&#8216;two&#8217;).style.display = &#8216;none&#8217;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; document.getElementById(&#8216;one&#8217;).style.display = &#8216;block&#8217;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; document.getElementById(&#8216;empty&#8217;).innerHTML = &#8216; &#8216;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; };<br />
&nbsp; &nbsp; &nbsp; &nbsp; document.getElementById(&#8216;lnk-two&#8217;).onclick = function() {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; document.getElementById(&#8216;one&#8217;).style.display = &#8216;none&#8217;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; document.getElementById(&#8216;two&#8217;).style.display = &#8216;block&#8217;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; document.getElementById(&#8216;empty&#8217;).innerHTML = &#8216; &#8216;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; };<br />
}<br />
<span class="sc2">&lt;<span class="sy0">/</span><a href="http://december.com/html/4/element/script.html"><span class="kw2">script</span></a>&gt;</span><br />
<span class="sc2">&lt;<span class="sy0">/</span><a href="http://december.com/html/4/element/head.html"><span class="kw2">head</span></a>&gt;</span><br />
<span class="sc2">&lt;<a href="http://december.com/html/4/element/body.html"><span class="kw2">body</span></a>&gt;</span><br />
<span class="sc2">&lt;<a href="http://december.com/html/4/element/a.html"><span class="kw2">a</span></a> <span class="kw3">href</span><span class="sy0">=</span><span class="st0">&quot;#&quot;</span> <span class="kw3">id</span><span class="sy0">=</span><span class="st0">&quot;lnk-one&quot;</span>&gt;</span>One<span class="sc2">&lt;<span class="sy0">/</span><a href="http://december.com/html/4/element/a.html"><span class="kw2">a</span></a>&gt;</span> <span class="sc2">&lt;<a href="http://december.com/html/4/element/a.html"><span class="kw2">a</span></a> <span class="kw3">href</span><span class="sy0">=</span><span class="st0">&quot;#&quot;</span> <span class="kw3">id</span><span class="sy0">=</span><span class="st0">&quot;lnk-two&quot;</span>&gt;</span>Two<span class="sc2">&lt;<span class="sy0">/</span><a href="http://december.com/html/4/element/a.html"><span class="kw2">a</span></a>&gt;</span><br />
<span class="sc2">&lt;<a href="http://december.com/html/4/element/div.html"><span class="kw2">div</span></a> <span class="kw3">id</span><span class="sy0">=</span><span class="st0">&quot;one&quot;</span>&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="sc2">&lt;<a href="http://december.com/html/4/element/ol.html"><span class="kw2">ol</span></a>&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="sc2">&lt;<a href="http://december.com/html/4/element/li.html"><span class="kw2">li</span></a>&gt;</span>one<span class="sc2">&lt;<span class="sy0">/</span><a href="http://december.com/html/4/element/li.html"><span class="kw2">li</span></a>&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="sc2">&lt;<a href="http://december.com/html/4/element/li.html"><span class="kw2">li</span></a>&gt;</span>two<span class="sc2">&lt;<span class="sy0">/</span><a href="http://december.com/html/4/element/li.html"><span class="kw2">li</span></a>&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="sc2">&lt;<span class="sy0">/</span><a href="http://december.com/html/4/element/ol.html"><span class="kw2">ol</span></a>&gt;</span><br />
<span class="sc2">&lt;<span class="sy0">/</span><a href="http://december.com/html/4/element/div.html"><span class="kw2">div</span></a>&gt;</span><br />
<span class="sc2">&lt;<a href="http://december.com/html/4/element/div.html"><span class="kw2">div</span></a> <span class="kw3">id</span><span class="sy0">=</span><span class="st0">&quot;two&quot;</span> <span class="kw3">style</span><span class="sy0">=</span><span class="st0">&quot;display:none&quot;</span>&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="sc2">&lt;<a href="http://december.com/html/4/element/ol.html"><span class="kw2">ol</span></a>&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="sc2">&lt;<a href="http://december.com/html/4/element/li.html"><span class="kw2">li</span></a>&gt;</span>three<span class="sc2">&lt;<span class="sy0">/</span><a href="http://december.com/html/4/element/li.html"><span class="kw2">li</span></a>&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="sc2">&lt;<a href="http://december.com/html/4/element/li.html"><span class="kw2">li</span></a>&gt;</span>four<span class="sc2">&lt;<span class="sy0">/</span><a href="http://december.com/html/4/element/li.html"><span class="kw2">li</span></a>&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="sc2">&lt;<span class="sy0">/</span><a href="http://december.com/html/4/element/ol.html"><span class="kw2">ol</span></a>&gt;</span><br />
<span class="sc2">&lt;<span class="sy0">/</span><a href="http://december.com/html/4/element/div.html"><span class="kw2">div</span></a>&gt;</span><br />
<span class="sc2">&lt;<a href="http://december.com/html/4/element/div.html"><span class="kw2">div</span></a> <span class="kw3">id</span><span class="sy0">=</span><span class="st0">&quot;empty&quot;</span>&gt;&lt;<span class="sy0">/</span><a href="http://december.com/html/4/element/div.html"><span class="kw2">div</span></a>&gt;</span><br />
<span class="sc2">&lt;<span class="sy0">/</span><a href="http://december.com/html/4/element/body.html"><span class="kw2">body</span></a>&gt;</span><br />
<span class="sc2">&lt;<span class="sy0">/</span><a href="http://december.com/html/4/element/html.html"><span class="kw2">html</span></a>&gt;</span></div>
</div>
<p>It&#8217;s important to place empty &lt;div&gt; after ordered lists. If you place it before &#8211; it won&#8217;t work.</p>
]]></content:encoded>
			<wfw:commentRss>http://klalex.com/2011/06/broken-ordered-list-in-ie9/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>The array declaration difference between Firefox and IE JavaScript interpreter</title>
		<link>http://klalex.com/2010/05/the-array-declaration-difference-between-firefox-and-ie-javascript-interpreter/</link>
		<comments>http://klalex.com/2010/05/the-array-declaration-difference-between-firefox-and-ie-javascript-interpreter/#comments</comments>
		<pubDate>Fri, 21 May 2010 12:18:02 +0000</pubDate>
		<dc:creator>klalex</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://klalex.com/?p=91</guid>
		<description><![CDATA[Found interesting difference in array declaration between FF and IE. For example, if leave comma (,) after all elements in array there will be different size of array as a result: var arr = &#91;1,2,3,&#93;; document.write&#40;arr.length&#41;; As a result in Firefox and Safari it will write &#8220;3&#8243; but in IE it will be &#8220;4&#8243;.]]></description>
			<content:encoded><![CDATA[<p>Found interesting difference in array declaration between FF and IE. For example, if leave comma (,) after all elements in array there will be different size of array as a result:</p>
<div class="codesnip-container" >
<div class="javascript codesnip" style="font-family:monospace;"><span class="kw2">var</span> arr <span class="sy0">=</span> <span class="br0">&#91;</span>1<span class="sy0">,</span>2<span class="sy0">,</span>3<span class="sy0">,</span><span class="br0">&#93;</span><span class="sy0">;</span><br />
document.<span class="kw1">write</span><span class="br0">&#40;</span>arr.<span class="me1">length</span><span class="br0">&#41;</span><span class="sy0">;</span></div>
</div>
<p>As a result in Firefox and Safari it will write &#8220;3&#8243; but in IE it will be &#8220;4&#8243;.</p>
]]></content:encoded>
			<wfw:commentRss>http://klalex.com/2010/05/the-array-declaration-difference-between-firefox-and-ie-javascript-interpreter/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jQuery UI: Datepicker for birth date input</title>
		<link>http://klalex.com/2009/07/jquery-ui-datepicker-for-birth-date-input/</link>
		<comments>http://klalex.com/2009/07/jquery-ui-datepicker-for-birth-date-input/#comments</comments>
		<pubDate>Sat, 11 Jul 2009 17:24:20 +0000</pubDate>
		<dc:creator>klalex</dc:creator>
				<category><![CDATA[jQuery]]></category>
		<category><![CDATA[birth date]]></category>
		<category><![CDATA[datepicker]]></category>
		<category><![CDATA[jQuery UI]]></category>

		<guid isPermaLink="false">http://klalex.com/?p=57</guid>
		<description><![CDATA[I decided to use jQuery UI Datepicker control for one of project and faced with the some strange behavior. At first, I decided to find a way to select month and year quickly because switching months with previous button will unhappy every user. So I&#8217;ve added the following options: $&#40;&#8216;#datepicker&#8217;&#41;.datepicker&#40;&#123; &#160; &#160; changeMonth: true, &#160; [...]]]></description>
			<content:encoded><![CDATA[<p>I decided to use <a href="http://jqueryui.com/demos/datepicker/">jQuery UI Datepicker control</a> for one of project and faced with the some strange behavior. At first, I decided to find a way to select month and year quickly because switching months with previous button will unhappy every user. So I&#8217;ve added the following options:</p>
<div class="codesnip-container" >
<div class="javascript codesnip" style="font-family:monospace;">$<span class="br0">&#40;</span><span class="st0">&#8216;#datepicker&#8217;</span><span class="br0">&#41;</span>.<span class="me1">datepicker</span><span class="br0">&#40;</span><span class="br0">&#123;</span><br />
&nbsp; &nbsp; changeMonth<span class="sy0">:</span> <span class="kw2">true</span><span class="sy0">,</span><br />
&nbsp; &nbsp; changeYear<span class="sy0">:</span> <span class="kw2">true</span><br />
<span class="br0">&#125;</span><span class="br0">&#41;</span><span class="sy0">;</span></div>
</div>
<p>Well it&#8217;s much better already but here I found that not much years are displayed in the dropdown &#8211; only from 1999 to 2019. I spent about minute to find out that range changes when I select year. So it shows -10 year as down date and +10 years as up value (from client I just got email that he cannot select his birth year so I bet whether this logic of work is useful).</p>
<p>To set fixed range of years in dropdown you need to use yearRange option. For instance, in my case it is:</p>
<div class="codesnip-container" >
<div class="javascript codesnip" style="font-family:monospace;">$<span class="br0">&#40;</span><span class="st0">&#8216;#datepicker&#8217;</span><span class="br0">&#41;</span>.<span class="me1">datepicker</span><span class="br0">&#40;</span><span class="br0">&#123;</span><br />
&nbsp; &nbsp; changeMonth<span class="sy0">:</span> <span class="kw2">true</span><span class="sy0">,</span><br />
&nbsp; &nbsp; changeYear<span class="sy0">:</span> <span class="kw2">true</span><span class="sy0">,</span><br />
&nbsp; &nbsp; yearRange<span class="sy0">:</span> <span class="st0">&#8217;1910:2000&#8242;</span><br />
<span class="br0">&#125;</span><span class="br0">&#41;</span><span class="sy0">;</span></div>
</div>
<p>Another interesting thing is that datepicker doesn&#8217;t allow me to select my birth day :) When I select March 1983 it shows days from 1 to 5 only:</p>
<p><img class="aligncenter size-full wp-image-58" title="picture-1" src="http://klalex.com/wp-content/uploads/2009/07/picture-1.png" alt="picture-1" width="225" height="148" /></p>
]]></content:encoded>
			<wfw:commentRss>http://klalex.com/2009/07/jquery-ui-datepicker-for-birth-date-input/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Open link in a new window in XHTML 1.0 Strict</title>
		<link>http://klalex.com/2009/06/open-link-in-a-new-window-in-xhtml-10-strict/</link>
		<comments>http://klalex.com/2009/06/open-link-in-a-new-window-in-xhtml-10-strict/#comments</comments>
		<pubDate>Tue, 23 Jun 2009 21:33:35 +0000</pubDate>
		<dc:creator>klalex</dc:creator>
				<category><![CDATA[jQuery]]></category>
		<category><![CDATA[Mac OS]]></category>
		<category><![CDATA[osCommerce]]></category>
		<category><![CDATA[Web Standards]]></category>
		<category><![CDATA[XHTML]]></category>
		<category><![CDATA[new window]]></category>
		<category><![CDATA[target]]></category>

		<guid isPermaLink="false">http://klalex.com/?p=51</guid>
		<description><![CDATA[As you may notice using target=&#8221;_blank&#8221; breaks XHTML 1.0 Stric validation. And here you are a solution with jQuery: Add rel=&#8221;external&#8221; for links that you want to be opened in a new window Include the following jQuery script: $&#40;function&#40;&#41; &#123; &#160; $&#40;&#34;a[rel*='external']&#34;&#41;.click&#40;function&#40;&#41; &#123; &#160; &#160; window.open&#40;$&#40;this&#41;.attr&#40;&#8216;href&#8217;&#41;, &#8216;external&#8217;, &#8221;&#41;; &#160; &#160; return false; &#160; &#125;&#41;; &#125;&#41;; [...]]]></description>
			<content:encoded><![CDATA[<p>As you may notice using target=&#8221;_blank&#8221; breaks XHTML 1.0 Stric validation. And here you are a solution with jQuery:</p>
<ol>
<li>Add rel=&#8221;external&#8221; for links that you want to be opened in a new window</li>
<li>Include the following jQuery script:<br/>
<div class="codesnip-container" >
<div class="javascript codesnip" style="font-family:monospace;">$<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><br />
&nbsp; $<span class="br0">&#40;</span><span class="st0">&quot;a[rel*='external']&quot;</span><span class="br0">&#41;</span>.<span class="me1">click</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><br />
&nbsp; &nbsp; window.<span class="kw3">open</span><span class="br0">&#40;</span>$<span class="br0">&#40;</span><span class="kw1">this</span><span class="br0">&#41;</span>.<span class="me1">attr</span><span class="br0">&#40;</span><span class="st0">&#8216;href&#8217;</span><span class="br0">&#41;</span><span class="sy0">,</span> <span class="st0">&#8216;external&#8217;</span><span class="sy0">,</span> <span class="st0">&#8221;</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; <span class="kw1">return</span> <span class="kw2">false</span><span class="sy0">;</span><br />
&nbsp; <span class="br0">&#125;</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
<span class="br0">&#125;</span><span class="br0">&#41;</span><span class="sy0">;</span></div>
</div>
</li>
</ol>
<p>But I agree that it&#8217;s annoying when link is opening in new tab(window) without your acceptance. Even for external links users can use hot key combination (Command + T in mac os or Ctrl + T in windows) to open a link in new tab. We should give user a choice to decide personally whether he/she wants to open a link in the same window or external. Or at least to notify somehow. Using popup window or even icon near the link that tells user that this link is external.</p>
]]></content:encoded>
			<wfw:commentRss>http://klalex.com/2009/06/open-link-in-a-new-window-in-xhtml-10-strict/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jQuery tips and tricks: &#8216;Add more&#8217; functionality in a table</title>
		<link>http://klalex.com/2009/06/add-more-functionality-in-table-with-jquery/</link>
		<comments>http://klalex.com/2009/06/add-more-functionality-in-table-with-jquery/#comments</comments>
		<pubDate>Mon, 22 Jun 2009 21:30:39 +0000</pubDate>
		<dc:creator>klalex</dc:creator>
				<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://klalex.com/?p=45</guid>
		<description><![CDATA[Usually we have &#8216;Add more&#8217; link on the forms. For example, on the project I&#8217;m working on right now there is registration form and user with Advanced package can create a few accounts. So we have &#8216;Add more&#8217; link that should add one more row with Name, Email and Password for adding another account. Because [...]]]></description>
			<content:encoded><![CDATA[<p>Usually we have &#8216;Add more&#8217; link on the forms. For example, on the project I&#8217;m working on right now there is registration form and user with Advanced package can create a few accounts. So we have &#8216;Add more&#8217; link that should add one more row with Name, Email and Password for adding another account. Because we use table in HTML for placing data fields, new row will be TR actually. And there is a little trick to add it.</p>
<p>Here you are:</p>
<div class="codesnip-container" >
<div class="javascript codesnip" style="font-family:monospace;">$<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><br />
&nbsp; $<span class="br0">&#40;</span><span class="st0">&quot;#add_more&quot;</span><span class="br0">&#41;</span>.<span class="me1">click</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><br />
&nbsp; &nbsp; $<span class="br0">&#40;</span><span class="st0">&quot;form table tr:last&quot;</span><span class="br0">&#41;</span>.<span class="me1">after</span><span class="br0">&#40;</span><span class="st0">&#8216;&lt;tr&gt;&#8230;&lt;/tr&gt;&#8217;</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; <span class="br0">&#125;</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
<span class="br0">&#125;</span><span class="br0">&#41;</span><span class="sy0">;</span></div>
</div>
<p>At first, I add click event handler on &#8216;Add more&#8217; link. In even handler declaration I find the last TR block in the table. Then use after() method to add new TR row.</p>
]]></content:encoded>
			<wfw:commentRss>http://klalex.com/2009/06/add-more-functionality-in-table-with-jquery/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Focus element in ThickBox</title>
		<link>http://klalex.com/2009/03/focus-element-in-thickbox/</link>
		<comments>http://klalex.com/2009/03/focus-element-in-thickbox/#comments</comments>
		<pubDate>Mon, 23 Mar 2009 22:16:19 +0000</pubDate>
		<dc:creator>klalex</dc:creator>
				<category><![CDATA[jQuery]]></category>
		<category><![CDATA[focus]]></category>
		<category><![CDATA[thickbox]]></category>

		<guid isPermaLink="false">http://klalex.com/?p=23</guid>
		<description><![CDATA[I faced with a problem focusing element in thickbox popup. I open login form using thickbox and want to take a focus on the first element of the form. Though the following code does look to be working: $&#40;document&#41;.ready&#40;function&#40;&#41; &#123; &#160; &#160; $&#40;&#34;input[name='username']&#34;&#41;.focus&#40;&#41;; &#125;&#41;; But there is a little trick. If you make a small [...]]]></description>
			<content:encoded><![CDATA[<p>I faced with a problem focusing element in thickbox popup. I open login form using thickbox and want to take a focus on the first element of the form. Though the following code does look to be working:</p>
<div class="codesnip-container" >
<div class="javascript codesnip" style="font-family:monospace;">$<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><br />
&nbsp; &nbsp; $<span class="br0">&#40;</span><span class="st0">&quot;input[name='username']&quot;</span><span class="br0">&#41;</span>.<span class="kw3">focus</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
<span class="br0">&#125;</span><span class="br0">&#41;</span><span class="sy0">;</span></div>
</div>
<p>But there is a little trick. If you make a small 100ms delay in focus() call it works:</p>
<div class="codesnip-container" >
<div class="javascript codesnip" style="font-family:monospace;">$<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><br />
&nbsp; &nbsp; setTimeout<span class="br0">&#40;</span><span class="st0">&quot;$(<span class="es0">\&quot;</span>input[name='username']<span class="es0">\&quot;</span>).focus();&quot;</span><span class="sy0">,</span> 100<span class="br0">&#41;</span><span class="sy0">;</span><br />
<span class="br0">&#125;</span><span class="br0">&#41;</span><span class="sy0">;</span></div>
</div>
]]></content:encoded>
			<wfw:commentRss>http://klalex.com/2009/03/focus-element-in-thickbox/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
	</channel>
</rss>

