<?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>teddy-risation &#187; jQuery</title>
	<atom:link href="http://teddy-o-ted.com/blog/tag/jquery/feed/" rel="self" type="application/rss+xml" />
	<link>http://teddy-o-ted.com</link>
	<description>Design of a minimalist, content of a maximalist</description>
	<lastBuildDate>Mon, 07 Nov 2011 17:41:03 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.4.1</generator>
		<item>
		<title>Better Form Usability with jQuery</title>
		<link>http://teddy-o-ted.com/blog/2010/08/08/better-form-usability-with-jquery/</link>
		<comments>http://teddy-o-ted.com/blog/2010/08/08/better-form-usability-with-jquery/#comments</comments>
		<pubDate>Sat, 07 Aug 2010 19:03:40 +0000</pubDate>
		<dc:creator>Terry</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Form]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[Usability]]></category>

		<guid isPermaLink="false">http://teddy-o-ted.com/?p=10488</guid>
		<description><![CDATA[The &#60;label&#62; tag is a rather commonly omitted element in HTML forms. Although the tag does not render text in it differently from those outside the tag, it provides a usability improvement for mouse users by duplicating common GUI features. More importantly, it couples an input element with a label for users of speech browsers. [...]]]></description>
			<content:encoded><![CDATA[<p>The <code>&lt;label&gt;</code> tag is a rather commonly omitted element in HTML forms. Although the tag does not render text in it differently from those outside the tag, it provides a usability improvement for mouse users by duplicating common GUI features. More importantly, it couples an input element with a label for users of speech browsers.</p>
<p>The <code>&lt;label&gt;</code> tag can be used as is, but it has an extremely useful attribute &#8211; the <code>for</code> attribute. This attribute allows one to associate a form control with the element, when its value matches the ID of the form control. Here&#8217;s a sample of a usable, but not the best, form, without the use of the <code>&lt;label&gt;</code> tag:</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">form</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;form-1&quot;</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">p</span>&gt;</span>
		<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">span</span>&gt;</span>Name<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">span</span>&gt;</span>
		<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">input</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text&quot;</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;author&quot;</span> <span style="color: #000066;">tabindex</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;1&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">p</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">p</span>&gt;</span>
		<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">span</span>&gt;</span>Email<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">span</span>&gt;</span>
		<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">input</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text&quot;</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;email&quot;</span> <span style="color: #000066;">tabindex</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;2&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">p</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">p</span>&gt;</span>
		<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">span</span>&gt;</span>URL<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">span</span>&gt;</span>
		<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">input</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text&quot;</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;url&quot;</span> <span style="color: #000066;">tabindex</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;3&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">p</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">p</span>&gt;</span>
		<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">span</span>&gt;</span>Comment<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">span</span>&gt;</span>
		<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">textarea</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;comment&quot;</span> <span style="color: #000066;">tabindex</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;4&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">p</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">p</span>&gt;</span>
		<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">input</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;submit&quot;</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;submit&quot;</span> <span style="color: #000066;">tabindex</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;5&quot;</span> <span style="color: #000066;">value</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;Submit&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">p</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">form</span>&gt;</span></pre></div></div>

<p>When we add the the <code>for</code> attribute to the <code>&lt;label&gt;</code> element and assign it a value that is identical to the <code>id</code> attribute of the form control, we will improve the usability of the form. For visually-impaired users, the speech browsers are able to draw a link between a form control and it’s label, which will provide important information and even instructions in filling up the form. For those using visual browsers are, in turn, able to focus on a specific form control when its associated label is clicked on.</p>
<p>Here is the improved form:</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">form</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;form-1&quot;</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">p</span>&gt;</span>
		<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">label</span> <span style="color: #000066;">for</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;author&quot;</span>&gt;</span>Name<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">label</span>&gt;</span>
		<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">input</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text&quot;</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;author&quot;</span> <span style="color: #000066;">tabindex</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;1&quot;</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;author&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">p</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">p</span>&gt;</span>
		<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">label</span> <span style="color: #000066;">for</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;email&quot;</span>&gt;</span>Email<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">label</span>&gt;</span>
		<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">input</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text&quot;</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;email&quot;</span> <span style="color: #000066;">tabindex</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;2&quot;</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;email&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">p</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">p</span>&gt;</span>
		<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">label</span> <span style="color: #000066;">for</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;url&quot;</span>&gt;</span>URL<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">label</span>&gt;</span>
		<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">input</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text&quot;</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;url&quot;</span> <span style="color: #000066;">tabindex</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;3&quot;</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;url&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">p</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">p</span>&gt;</span>
		<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">label</span> <span style="color: #000066;">for</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;comment&quot;</span>&gt;</span>Comment<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">label</span>&gt;</span>
		<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">textarea</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;comment&quot;</span> <span style="color: #000066;">tabindex</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;4&quot;</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;comment&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">p</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">p</span>&gt;</span>
		<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">input</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;submit&quot;</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;submit&quot;</span> <span style="color: #000066;">tabindex</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;5&quot;</span> <span style="color: #000066;">value</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;Submit&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">p</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">form</span>&gt;</span></pre></div></div>

<h2>What does jQuery have to do with this?</h2>
<p>You must be puzzled &#8211; afterall, what you need to do so far is to manually inject the <code>for</code> and <code>id</code> attributes into the <code>&lt;label&gt;</code> and <code>&lt;input&gt;</code> elements respectively. In fact, I was actually doing these manual changes to my theme files and other web-based projects because it will only take me at most a few minutes&#8217; worth of time.</p>
<p>However, I recently faced a problem that I felt using jQuery as a workaround wasn&#8217;t a bad idea afterall. Many people would advice against using JavaScript in cases like this for two reasons: some users, albeit a minority, don&#8217;t allow JavaScript to run on their browser; and on a related note, with the possibility that JavaScript being disabled in mind, we shouldn&#8217;t use it to implement essential features.</p>
<p>The problem was that I was working with some WP plugins that generates HTML forms dynamically and on the fly. Although some would dive into the realm of PHP and make the necessary changes such that the generated forms are more user-friendly, I would prefer using the jQuery way, which is easier and does not require muddling with the source code of the plugin files.</p>
<p>There are a few steps that we have to do:</p>
<ol>
<li>Retrieve the value of the <code>name</code> attribute of the <code>&lt;input&gt;</code> element.</li>
<li>Assign a unique ID to the <code>&lt;input&gt;</code> element.</li>
<li>Assign the same value (the unique ID) to the <code>for</code> attribute of <code>&lt;label&gt;</code>.</li>
</ol>
<p>For those copy-happy folks, here&#8217;s the code:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">jQuery<span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span> <span style="color: #009900;">&#40;</span>$<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
 	$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#form-1 &gt; p&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">each</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>count<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #003366; font-weight: bold;">var</span> input_id <span style="color: #339933;">=</span> $<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">children</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;input&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">attr</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;name&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> <span style="color: #009900;">&#40;</span>count <span style="color: #339933;">+</span> <span style="color: #CC0000;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		$<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">children</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;input&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">attr</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;id&quot;</span><span style="color: #339933;">,</span> input_id<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		$<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">children</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;label&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">attr</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;for&quot;</span><span style="color: #339933;">,</span> input_id<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<h2>Dissecting the code</h2>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#form-1 &gt; p&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">each</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>count<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span></pre></div></div>

<p>This line searches the document for the paragraphy element, <code>&lt;p&gt;</code> that is a direct descendant of an element with an ID of <code>#form-1</code>. The <code>.each()</code> function makes sure that we look the subsequent function across all elements that satisfy the selection criteria. The <code>count</code> variable is declared and it will be used in each iteration.</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">var</span> input_id <span style="color: #339933;">=</span> $<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">children</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;input&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">attr</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;name&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> <span style="color: #009900;">&#40;</span>count <span style="color: #339933;">+</span> <span style="color: #CC0000;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>This line defines the variable <code>input_id</code>, and assigns it the value of that is the that of the <code>name</code> attribute of the <code>&lt;input&gt;</code> element combined with a unique number. The number is increased by a value of 1 after each iteration of the loop so that we will generate unique IDs, even in face of an unprobably scenario that two input fields on the same page share the same value of the <code>name</code> attribute.</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">$<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">children</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;input&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">attr</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;id&quot;</span><span style="color: #339933;">,</span> input_id<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
$<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">children</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;label&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">attr</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;for&quot;</span><span style="color: #339933;">,</span> input_id<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>These two lines do the same thing &#8211; the finds the <code>&lt;input&gt;</code> and <code>&lt;label&gt;</code> elements in the same parent element, and assigns the generated value to the <code>id</code> of the former and <code>for</code> attribute of the latter.</p>
<h2>Note</h2>
<p>Note that this technique only works if each <code>&lt;label&gt;</code> and <code>&lt;input&gt;</code> pair is located in the same parent element, and each parent element has only one pair of label and input field in it. Of course, there is a solution for those forms that do not wrap each pair in a parent element, but I will not dwell into it.</p>
<h3  class="related_post_title">Related</h3><p>Related posts that might interest you:</p><ul class="related_post"><li><a href="http://teddy-o-ted.com/blog/2010/05/22/wp-widget-load-posts-in-a-category/" title="WP Widget: Load posts in a category">WP Widget: Load posts in a category</a></li><li><a href="http://teddy-o-ted.com/blog/2009/09/10/35-stylish-and-modern-wordpress-plugins-using-jquery-ui/" title="35 Stylish And Modern Wordpress Plugins Using jQuery UI">35 Stylish And Modern Wordpress Plugins Using jQuery UI</a></li><li><a href="http://teddy-o-ted.com/blog/2009/05/24/wp-theme-teddy-risation-theta/" title="WP theme: teddy-risation Theta">WP theme: teddy-risation Theta</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://teddy-o-ted.com/blog/2010/08/08/better-form-usability-with-jquery/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>35 Stylish And Modern WordPress Plugins Using jQuery UI</title>
		<link>http://teddy-o-ted.com/blog/2009/09/10/35-stylish-and-modern-wordpress-plugins-using-jquery-ui/</link>
		<comments>http://teddy-o-ted.com/blog/2009/09/10/35-stylish-and-modern-wordpress-plugins-using-jquery-ui/#comments</comments>
		<pubDate>Thu, 10 Sep 2009 13:31:39 +0000</pubDate>
		<dc:creator>Terry</dc:creator>
				<category><![CDATA[Bookmarked]]></category>
		<category><![CDATA[Design]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[Plugin]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://www.teddy-o-ted.com/?p=3999</guid>
		<description><![CDATA[Dainis over at 1st Web Designer compiled a list of <a title="35 Stylish And Modern Wordpress Plugins Using jQuery UI" href="http://www.1stwebdesigner.com/wordpress/35-stylish-and-modern-wordpress-plugins-using-jquery-ui/">35 elegantly designed, flexible and stylish Wordpress plugins</a> built on jQuery UI. Some of the plugins may actually be very helpful and many improve the user experience on your site, such as the <a title="jQuery Pagebar" href="http://wordpress.org/extend/plugins/jquery-pagebar/">jQuery pagebar</a>, a highly coveted feature once exclusively found in the Wordpress K2 theme.]]></description>
			<content:encoded><![CDATA[<div id="attachment_3386" class="wp-caption aligncenter" style="width: 610px"><a href="http://www.1stwebdesigner.com/wordpress/35-stylish-and-modern-wordpress-plugins-using-jquery-ui/"><img src="http://www.teddy-o-ted.com/wp-content/uploads/2009/03/8jsfixesforcss.jpg" alt="35 Stylish And Modern WordPress Plugins Using jQuery UI" title="35 Stylish And Modern WordPress Plugins Using jQuery UI" width="600" height="233" class="size-full wp-image-3386" /></a><p class="wp-caption-text">35 Stylish And Modern WordPress Plugins Using jQuery UI</p></div>
<p>Dainis over at 1st Web Designer compiled a list of <a title="35 Stylish And Modern WordPress Plugins Using jQuery UI" href="http://www.1stwebdesigner.com/wordpress/35-stylish-and-modern-wordpress-plugins-using-jquery-ui/">35 elegantly designed, flexible and stylish WordPress plugins</a> built on jQuery UI. Some of the plugins may actually be very helpful and many improve the user experience on your site, such as the <a title="jQuery Pagebar" href="http://wordpress.org/extend/plugins/jquery-pagebar/">jQuery pagebar</a>, a highly coveted feature once exclusively found in the WordPress K2 theme.</p>
<h3  class="related_post_title">Related</h3><p>Related posts that might interest you:</p><ul class="related_post"><li><a href="http://teddy-o-ted.com/blog/2009/05/24/wp-theme-teddy-risation-theta/" title="WP theme: teddy-risation Theta">WP theme: teddy-risation Theta</a></li><li><a href="http://teddy-o-ted.com/blog/2008/03/31/scrambled-eggs/" title="Scrambled Eggs">Scrambled Eggs</a></li><li><a href="http://teddy-o-ted.com/blog/2009/05/23/theres-something-in-the-making/" title="There&#8217;s something in the making">There&#8217;s something in the making</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://teddy-o-ted.com/blog/2009/09/10/35-stylish-and-modern-wordpress-plugins-using-jquery-ui/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>WP theme: teddy-risation Theta</title>
		<link>http://teddy-o-ted.com/blog/2009/05/24/wp-theme-teddy-risation-theta/</link>
		<comments>http://teddy-o-ted.com/blog/2009/05/24/wp-theme-teddy-risation-theta/#comments</comments>
		<pubDate>Sat, 23 May 2009 18:25:39 +0000</pubDate>
		<dc:creator>Terry</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Design]]></category>
		<category><![CDATA[Photoshop]]></category>
		<category><![CDATA[Framework]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[Theme]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://www.teddy-o-ted.com/?p=3695</guid>
		<description><![CDATA[So here we have, the eight teddy-risation WP theme in it&#8217;s fully glory. Just like the other write-ups that I do for my previous themes, I will be doing one for this one as well, no exceptions. Not only does this entry helps to catalogue my list of themes and my insights of designing them [...]]]></description>
			<content:encoded><![CDATA[<div id="attachment_3696" class="wp-caption aligncenter" style="width: 610px"><img class="size-full wp-image-3696" title="teddy-risation Theta released!" src="http://www.teddy-o-ted.com/wp-content/uploads/2009/05/teddyrisationtheta02.jpg" alt="teddy-risation Theta released!" width="600" height="400" /><p class="wp-caption-text">teddy-risation Theta released!</p></div>
<p>So here we have, the eight teddy-risation WP theme in it&#8217;s fully glory. Just like the other write-ups that I do for my previous themes, I will be doing one for this one as well, no exceptions. Not only does this entry helps to catalogue my list of themes and my insights of designing them (I have goldfish memory, so a backup medium for my cranial storage is needed), but I hope it will also inspire others as well.</p>
<p>teddy-risation Theta is coupled with the tiny rebranding movement I&#8217;ve embarked on, to ditch the funky (and not very impressive) capitalised letters in the site name and my nick as well. Known by the pseudonym &#8216;teddY&#8217; in the past, I am now changing back to &#8216;Teddy&#8217; or as simple as it gets, my real name, Terry. You can address me with both names now, I really don&#8217;t mind, no worries!</p>
<p>This theme took the longest to design &#8211; the date of its conception was actually somewhere during and after my first year final semester examinations. Ideas always have to came at the wrongest of all wrong times, don&#8217;t they? I did a simple sketch on what I wanted on paper, and moved on to my studies. When the exams ended, I immediately started materialising the layout in Photoshop, starting from the header section.</p>
<h2>Theme Hybrid</h2>
<p>Theta is actually a child theme of <a title="Theme Hybrid: A WordPress theme club" href="http://themehybrid.com/">Theme Hybrid</a>. It is a <em>free</em> WP theme and you can modify it in anyway you want, or even create your own child themes that rely on the Hybrid framework. I did modify a few core files on the Hybrid theme, but other than that, all the styling and customisation you see here leaves the original Hybrid files completely untouched. That means that I can easily update my theme when Hybrid issues one, without breaking my child theme.</p>
<p>In the past I&#8217;ve always used <a title="Sandbox theme" href="http://www.plaintxt.org/themes/sandbox/">Sandbox</a>. However, I&#8217;ve decided to try out other new WP themes because sadly, the Sandbox creators have paused the development of the theme and the future is rather bleak. I have to say that I really loved working on Sandbox, <a title="Andy Skelton" href="http://andy.wordpress.com/">Andy</a> and <a title="Scott Allan Wallick" href="http://www.plaintxt.org/">Scott</a> &#8211; I really appreciate the support and help you&#8217;ve rendered to users of your theme and your dedicated effort. Because of that reason, I realised that I have to start learning how to work on other WP themes &#8211; out of the many available options like <a title="Thematic theme" href="http://wordpress.org/extend/themes/thematic">Thematic</a>, <a title="WP Framework" href="http://wpframework.com/">WP Framework</a>, <a title="Whiteboard" href="http://plainbeta.com/2008/05/20/whiteboard-a-free-wordpress-theme-framework/">Whiteboard</a> and <a title="The Buffet Framework" href="http://www.zy.sg/the-buffet-framework/">The Buffet Framework</a>, I&#8217;ve chose Hybrid&#8230; for just one reason &#8211; the main colour scheme is greyish blue. What a biased choice, isn&#8217;t it?</p>
<p>Hybrid was a little hard to tame at first, I find myself constantly referring to different files in the library for hooks, filters and etc. The styling was a little more challenging to do, because unlike Sandbox that came in plain and simple, Hybrid has a basic stylesheet built into it and it takes time to figure things out. One thing I really love about Hybrid is that it has <em>wonderful typography</em> &#8211; while I have inherited the font family from the previous theme, the spacings and arrangement of text-based elements are all inherited wholely from the 22px stylesheet. Hybrid comes with a few different stylehsheets &#8211; 18px, 20px and etc, indicating the line height. I wanted my text to be more spaced out, so I picked 22px.</p>
<h2>Randomity, and the essence of it</h2>
<p>This theme incorporated some interesting randomity in it &#8211; the gallery images in the gallery window changes everytime you load it &#8211; not only does the array of images displayed changes, their arrangement is also jumbled up upon each reload. I&#8217;ve combined several shuffling and randomising techniques to achieve that, maybe I&#8217;ll blog about it later :) if you want it, just tell me.</p>
<p>Another one is the Twitter users that I follow &#8211; I have their avatars displayed in the sidebar. I have a lot of them, but I only randomly display 14 of them while the rest is hidden so that I do not clutter the sidebar up. It&#8217;s a lot of PHP stuff that I had to do, but it was fun! I spent one whole day just doing the PHP part for the Twitter widget. Tedious, but very fun and enlightening.</p>
<h2>Fonts and sIFR</h2>
<p>The main typeface I use for the headers and the introductory paragraph is <a title="Alte Haas Grotesk" href="http://www.dafont.com/alte-haas-grotesk.font">Alte Haas Grotesk</a> by designer <a title="Yann le Coroller's site" href="http://www.yannlecoroller.com/">Yann le Coroller</a>. The fontw as featured in the previous week&#8217;s <em>Fonty Friday</em> feature, which I run on a weekly basis. For the logo, I used <a title="Colaborate Font Family" href="http://www.fontsquirrel.com/fonts/Colaborate">Colaborate Regular</a> by <a title="Ralph Oliver du Carrois" href="http://www.carrois.com/">Ralph Oliver du Carrois</a>.</p>
<p>Since not everyone has Alte Haas Grotesk installed in their computers and that the CSS support for @font-face is rather patchy, font replacement methods, whether is it by flash or by images, are preferred. I did a little research and decide to settle for <a title="sIFR 2.0: Rich Accessible Typography for the Masses" href="http://www.mikeindustries.com/blog/sifr/">sIFR</a> &#8211; Scalable Inman Flash Replacement. I&#8217;ve made sIFR to only replace post and page titles, so that I won&#8217;t overload your computer and make performance sluggish &#8211; anyway, it&#8217;s really, really not recommended that you use sIFR for a big chuck of text! Keep it to headers only :)</p>
<h2>Javascript-powered feautures that gracefully degrades</h2>
<p>One feature that I put in a lot of effort struggling to make sure that it gets incorporated into the theme is gracefully-degrading javascript-powered features when javascript is not available or disabled. As you know, many sites nowadays are powered by javascript and many of them actually breaks when JS is disabled &#8211; a good example will be YouTube &#8211; try disabling JS in your browser and see what happens.</p>
<p>Most of the effects you see here are powered by<a title="jQuery: The Write Less, Do More, JavaScript Library" href="http://jquery.com/"> jQuery</a>, a very light-weight javascript library that helps you to achieve many things that requires advance knowledge of javascript in the past. Simple actions like the toggle effect in the comment form (try clicking on the labels and see what happen) and in the Twitter section on the sidebar (visible on main page only) are easily achieved by knowing just a little bit of jQuery. Lovely, isn&#8217;t it?</p>
<p>jQuery also allows me to select last-child of a parent element &#8211; the :last-child pseudo-class is not very well supported in every single browser (hint hint, IE6) and so we can actually use jQuery to insert a class to the last-child. If JS is disabled, the visual impact is not too obvious to be seen while in most JS-enabled visitors, it helps to achieve a uniform, consistent appearance of list items and etc.</p>
<p>jQuery is also used to create the fading effect of the header navigation links, as well as the Next and Prev buttons of the gallery window in the header. I might be writing a little more about how that is achieved in the future, but I shall not bore you to death in this entry.</p>
<p>I&#8217;m still learning how to use jQuery, so in this theme&#8217;s <a title="Functions javascript" href="http://www.teddy-o-ted.com/wp-content/themes/Teddyrisationtheta/js/functions.js">functions.js file</a>, I&#8217;ve also added annotations and urls to useful websites for first-time jQuery learners. They are excellent resources where one can start learning jQuery, with little prior knowledge of any programming languages.</p>
<h2>The 404 page</h2>
<p>For this theme, I&#8217;ve also designed a cute little 404 page that people will land on if they&#8217;ve followed a <a title="A 404 Page (/wp-admins/ does not exist, only /wp-admin/)" href="http://www.teddy-o-ted.com/wp-admins/">broken link</a> (it can be any, but I &#8216;m giving you this for convenience&#8217;s sake). Check it out!</p>
<h2>Improved gallery</h2>
<p>Last, but not least, the <a title="Gallery" href="http://www.teddy-o-ted.com/gallery/">Gallery page</a> has been improved upon too. Without the obstruction of the sidebar, there&#8217;s now more space for photos, heh!</p>
<h2>That&#8217;s all!</h2>
<p>I guess I shall keep this post short. If you have any questions, feel free to shoot! Anyway, I have a question for anyone who&#8217;s reading this: <strong>what WP themes do you use for your theme framework? Do you create a theme completely from groundup, or modify existing themes</strong> (like me)<strong> ?</strong></p>
<h3  class="related_post_title">Related</h3><p>Related posts that might interest you:</p><ul class="related_post"><li><a href="http://teddy-o-ted.com/blog/2009/09/10/35-stylish-and-modern-wordpress-plugins-using-jquery-ui/" title="35 Stylish And Modern Wordpress Plugins Using jQuery UI">35 Stylish And Modern Wordpress Plugins Using jQuery UI</a></li><li><a href="http://teddy-o-ted.com/blog/2008/12/01/presenting-teddy-risation-eta/" title="Presenting teddY-risatioNâ„¢ Eta">Presenting teddY-risatioNâ„¢ Eta</a></li><li><a href="http://teddy-o-ted.com/blog/2008/06/13/teddy-risation%e2%84%a2-zeta-released/" title="teddY-risatioNâ„¢ Zeta Released!">teddY-risatioNâ„¢ Zeta Released!</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://teddy-o-ted.com/blog/2009/05/24/wp-theme-teddy-risation-theta/feed/</wfw:commentRss>
		<slash:comments>20</slash:comments>
		</item>
		<item>
		<title>8 Javascript solutions to common CSS problems</title>
		<link>http://teddy-o-ted.com/blog/2009/03/24/8-javascript-solutions-to-common-css-problems/</link>
		<comments>http://teddy-o-ted.com/blog/2009/03/24/8-javascript-solutions-to-common-css-problems/#comments</comments>
		<pubDate>Mon, 23 Mar 2009 20:34:45 +0000</pubDate>
		<dc:creator>Terry</dc:creator>
				<category><![CDATA[Bookmarked]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[Design]]></category>
		<category><![CDATA[Fix]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://www.teddy-o-ted.com/?p=3384</guid>
		<description><![CDATA[Jean-Baptiste Jung shares <a title="8 Javascript solutions to common CSS problems" href="http://www.catswhocode.com/blog/8-javascript-solutions-to-common-css-problems">8 ingenious jQuery-based javascript solutions</a> on CatsWhoCode.comto circumvent the common CSS problems. While CSS is a semantically correct way of styling your webpages, not all popular browsers (like IE6, I know this comes very naturally for a designer) support CSS3 and there's always this problem of cross-browser compatibility.]]></description>
			<content:encoded><![CDATA[<div id="attachment_3386" class="wp-caption aligncenter" style="width: 610px"><a href="http://www.catswhocode.com/blog/8-javascript-solutions-to-common-css-problems"><img class="size-full wp-image-3386" title="8 Javascript solutions to common CSS problems" src="http://www.teddy-o-ted.com/wp-content/uploads/2009/03/8jsfixesforcss.jpg" alt="8 Javascript solutions to common CSS problems" width="600" height="233" /></a><p class="wp-caption-text">8 Javascript solutions to common CSS problems</p></div>
<p>Jean-Baptiste Jung shares <a title="8 Javascript solutions to common CSS problems" href="http://www.catswhocode.com/blog/8-javascript-solutions-to-common-css-problems">8 ingenious jQuery-based javascript solutions</a> on CatsWhoCode.comto circumvent the common CSS problems. While CSS is a semantically correct way of styling your webpages, not all popular browsers (like IE6, I know this comes very naturally for a designer) support CSS3 and there&#8217;s always this problem of cross-browser compatibility. Little do many people know that Javascript can actually fix a myriad of CSS problems &#8211; you&#8217;ve never thought they go along well together, do you?</p>
<p>From important fixes like the jQuery PNG transparency fix to the absolutely evil IE6-crashing script (so as to scare visitors into switching browsers, or is it more like scaring visitors away? That&#8217;s up to you), this article is a must-read for designers and coders alike.</p>
<h3  class="related_post_title">Related</h3><p>Related posts that might interest you:</p><ul class="related_post"><li><a href="http://teddy-o-ted.com/blog/2009/03/22/easy-display-switch-with-css-and-jquery/" title="Easy Display Switch with CSS and jQuery">Easy Display Switch with CSS and jQuery</a></li><li><a href="http://teddy-o-ted.com/blog/2009/02/21/compacting-contents-using-glider-script/" title="Compacting contents using Glider script">Compacting contents using Glider script</a></li><li><a href="http://teddy-o-ted.com/blog/2008/09/05/fix-for-buggy-flickr-badge-js/" title="Fix for buggy Flickr badge JS">Fix for buggy Flickr badge JS</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://teddy-o-ted.com/blog/2009/03/24/8-javascript-solutions-to-common-css-problems/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Easy Display Switch with CSS and jQuery</title>
		<link>http://teddy-o-ted.com/blog/2009/03/22/easy-display-switch-with-css-and-jquery/</link>
		<comments>http://teddy-o-ted.com/blog/2009/03/22/easy-display-switch-with-css-and-jquery/#comments</comments>
		<pubDate>Sat, 21 Mar 2009 17:39:51 +0000</pubDate>
		<dc:creator>Terry</dc:creator>
				<category><![CDATA[Bookmarked]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[Design]]></category>
		<category><![CDATA[Fluid]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[Switch]]></category>

		<guid isPermaLink="false">http://www.teddy-o-ted.com/?p=3360</guid>
		<description><![CDATA[As javascript libraries becomes increasingly popular among designers and website visitors alike, your daily visitors are now expecting more than just static pages - they would be thrilled to see interactive, fluid pages. In 2006 <a title="In Search of the Holy Grail" href="http://www.alistapart.com/articles/holygrail/">A List Apart published an article</a> on the holy grail of webdesign, which involves coding for fluid layouts in CSS. With the popularity of  javascript libraries like jQuery, <a title="Easy Display Switch with CSS and jQuery" href="http://designm.ag/tutorials/jquery-display-switch/">Soh Tanaka has written an excellent tutorial</a> on teaching us how to incorporate fluid display options on our pages - allowing visitors to switch between different forms of display (think iTunes libraries). An interesting concept that is actually very simple, and can be easily done with a few lines of jQuery and CSS.]]></description>
			<content:encoded><![CDATA[<div id="attachment_3361" class="wp-caption aligncenter" style="width: 610px"><a href="http://designm.ag/tutorials/jquery-display-switch/"><img class="size-full wp-image-3361" title="Easy Display Switch with CSS and jQuery" src="http://www.teddy-o-ted.com/wp-content/uploads/2009/03/displayswitch01.jpg" alt="Easy Display Switch with CSS and jQuery" width="600" height="588" /></a><p class="wp-caption-text">Easy Display Switch with CSS and jQuery</p></div>
<p>As javascript libraries becomes increasingly popular among designers and website visitors alike, your daily visitors are now expecting more than just static pages &#8211; they would be thrilled to see interactive, fluid pages. In 2006 <a title="In Search of the Holy Grail" href="http://www.alistapart.com/articles/holygrail/">A List Apart published an article</a> on the holy grail of webdesign, which involves coding for fluid layouts in CSS. With the popularity ofÂ  javascript libraries like jQuery, <a title="Easy Display Switch with CSS and jQuery" href="http://designm.ag/tutorials/jquery-display-switch/">Soh Tanaka has written an excellent tutorial</a> on teaching us how to incorporate fluid display options on our pages &#8211; allowing visitors to switch between different forms of display (think iTunes libraries). An interesting concept that is actually very simple, and can be easily done with a few lines of jQuery and CSS.</p>
<p>Basically, the technique behind the display switch is simply to style the list containing the gallery items separately &#8211; one in the thumbnail form and the other in the detailed listing form. And then you will use jQuery to add/remove a class that is appended to the list, to achieve the different appearance all coded by CSS.</p>
<h3  class="related_post_title">Related</h3><p>Related posts that might interest you:</p><ul class="related_post"><li><a href="http://teddy-o-ted.com/blog/2009/03/24/8-javascript-solutions-to-common-css-problems/" title="8 Javascript solutions to common CSS problems">8 Javascript solutions to common CSS problems</a></li><li><a href="http://teddy-o-ted.com/blog/2009/02/21/compacting-contents-using-glider-script/" title="Compacting contents using Glider script">Compacting contents using Glider script</a></li><li><a href="http://teddy-o-ted.com/blog/2006/11/09/whats-up-2/" title="What&#8217;s Up?">What&#8217;s Up?</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://teddy-o-ted.com/blog/2009/03/22/easy-display-switch-with-css-and-jquery/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
<!-- WP Super Cache is installed but broken. The path to wp-cache-phase1.php in wp-content/advanced-cache.php must be fixed! -->