<?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>Ultimate Web Development (CSS, HTML, jQuery, WordPress) - Dimox.net &#187; jQuery</title>
	<atom:link href="http://dimox.net/category/jquery/feed/" rel="self" type="application/rss+xml" />
	<link>http://dimox.net</link>
	<description>CSS, HTML, jQuery, WordPress</description>
	<lastBuildDate>Mon, 23 Jan 2012 14:53:38 +0000</lastBuildDate>
	
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Say &#8220;Welcome back!&#8221; to Commentators on WordPress Using jQuery</title>
		<link>http://dimox.net/say-welcome-back-to-commentators-on-wordpress-using-jquery/</link>
		<comments>http://dimox.net/say-welcome-back-to-commentators-on-wordpress-using-jquery/#comments</comments>
		<pubDate>Mon, 14 Jun 2010 11:53:18 +0000</pubDate>
		<dc:creator>Dimox</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[comment form]]></category>
		<category><![CDATA[script]]></category>

		<guid isPermaLink="false">http://dimox.net/?p=21</guid>
		<description><![CDATA[I wrote a small jQuery script, which aims to improve the convenience of commenting on WordPress site, and I want to share it with you.

The essence of the script is as follows: it shows a welcome message for regular commentators.]]></description>
			<content:encoded><![CDATA[<p>I wrote a small jQuery script, which aims to improve the convenience of commenting on WordPress site, and I want to share it with you.</p>
<p>The essence of the script is as follows: it shows a welcome message for regular commentators.</p>
<h3>How it works</h3>
<p>It&#8217;s very simple. Script checks whether the required fields <code>Name/E-mail</code> are filled and performs the following:</p>
<ul>
<li>If a visitor of your blog at least once left a comment, next time he will see a &#8220;<strong>Welcome back, %username%!</strong>&#8221; message at the comment form.</li>
<li>The <code>Name/E-mail/URL</code> fields will hide, there will be only comment field.</li>
<li>Commentator can change his data by clicking on &#8220;Edit&#8221; link.</li>
<li>If visitor has disabled JavaScript in his browser, he will see the full comment form.</li>
</ul>
<p>For working the script it&#8217;s necessary to satisfy the two conditions:</p>
<ol>
<li>Cookies must work in visitor&#8217;s browser.</li>
<li>WordPress must remember a previously entered data in comment form.</li>
</ol>
<p>Always be sure that the second condition is satisfied, otherwise there will no sense in connecting the script. I know what some WordPress plugins can prevent to output entered data in the comment form.</p>
<h3>Examples</h3>
<ol>
<li>If you at least once left a comment on this blog, you will see &#8220;Welcome back&#8221; message near the comment form.</li>
<li>Also you can see an example on a separate page:</li>
</ol>
<div class="download">
<div class="dl">
<div class="demo"><a href="http://dimox.net/demo/welcome-back-commentator.html">View Demo</a></div>
<div class="leftFold"></div>
</div>
</div>
<h3>How to use it</h3>
<ol>
<li>
<p>Find in the <code>comments.php</code> file of your theme the code of a name, e-mail and URL fields and wrap them into the <code>&lt;div id="authorData">&lt;/div></code> container.</p>
<p>I&#8217;ll show an example with default WordPress theme.</p>
<p>Before:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">p</span>&gt;&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;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;author&quot;</span> <span style="color: #000066;">value</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;&lt;?php echo esc_attr($comment_author); ?&gt;</span></span>&quot; size=&quot;22&quot; tabindex=&quot;1&quot; <span style="color: #009900;">&lt;?php if <span style="color: #66cc66;">&#40;</span>$req<span style="color: #66cc66;">&#41;</span> echo <span style="color: #ff0000;">&quot;aria-required='true'&quot;</span>; ?&gt;</span> /&gt;
<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;&lt;<span style="color: #000000; font-weight: bold;">small</span>&gt;</span>Name <span style="color: #009900;">&lt;?php if <span style="color: #66cc66;">&#40;</span>$req<span style="color: #66cc66;">&#41;</span> echo <span style="color: #ff0000;">&quot;(required)&quot;</span>; ?&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">small</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">label</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">p</span>&gt;</span>
&nbsp;
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">p</span>&gt;&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;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;email&quot;</span> <span style="color: #000066;">value</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;&lt;?php echo esc_attr($comment_author_email); ?&gt;</span></span>&quot; size=&quot;22&quot; tabindex=&quot;2&quot; <span style="color: #009900;">&lt;?php if <span style="color: #66cc66;">&#40;</span>$req<span style="color: #66cc66;">&#41;</span> echo <span style="color: #ff0000;">&quot;aria-required='true'&quot;</span>; ?&gt;</span> /&gt;
<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;&lt;<span style="color: #000000; font-weight: bold;">small</span>&gt;</span>Mail (will not be published) <span style="color: #009900;">&lt;?php if <span style="color: #66cc66;">&#40;</span>$req<span style="color: #66cc66;">&#41;</span> echo <span style="color: #ff0000;">&quot;(required)&quot;</span>; ?&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">small</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">label</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">p</span>&gt;</span>
&nbsp;
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">p</span>&gt;&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;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;url&quot;</span> <span style="color: #000066;">value</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;&lt;?php echo esc_attr($comment_author_url); ?&gt;</span></span>&quot; size=&quot;22&quot; tabindex=&quot;3&quot; /&gt;
<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;&lt;<span style="color: #000000; font-weight: bold;">small</span>&gt;</span>Website<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">small</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">label</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">p</span>&gt;</span></pre></div></div>

<p>After:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;authorData&quot;</span>&gt;</span>
  <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">p</span>&gt;&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;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;author&quot;</span> <span style="color: #000066;">value</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;&lt;?php echo esc_attr($comment_author); ?&gt;</span></span>&quot; size=&quot;22&quot; tabindex=&quot;1&quot; <span style="color: #009900;">&lt;?php if <span style="color: #66cc66;">&#40;</span>$req<span style="color: #66cc66;">&#41;</span> echo <span style="color: #ff0000;">&quot;aria-required='true'&quot;</span>; ?&gt;</span> /&gt;
  <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;&lt;<span style="color: #000000; font-weight: bold;">small</span>&gt;</span>Name <span style="color: #009900;">&lt;?php if <span style="color: #66cc66;">&#40;</span>$req<span style="color: #66cc66;">&#41;</span> echo <span style="color: #ff0000;">&quot;(required)&quot;</span>; ?&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">small</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">label</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">p</span>&gt;</span>
&nbsp;
  <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">p</span>&gt;&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;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;email&quot;</span> <span style="color: #000066;">value</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;&lt;?php echo esc_attr($comment_author_email); ?&gt;</span></span>&quot; size=&quot;22&quot; tabindex=&quot;2&quot; <span style="color: #009900;">&lt;?php if <span style="color: #66cc66;">&#40;</span>$req<span style="color: #66cc66;">&#41;</span> echo <span style="color: #ff0000;">&quot;aria-required='true'&quot;</span>; ?&gt;</span> /&gt;
  <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;&lt;<span style="color: #000000; font-weight: bold;">small</span>&gt;</span>Mail (will not be published) <span style="color: #009900;">&lt;?php if <span style="color: #66cc66;">&#40;</span>$req<span style="color: #66cc66;">&#41;</span> echo <span style="color: #ff0000;">&quot;(required)&quot;</span>; ?&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">small</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">label</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">p</span>&gt;</span>
&nbsp;
  <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">p</span>&gt;&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;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;url&quot;</span> <span style="color: #000066;">value</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;&lt;?php echo esc_attr($comment_author_url); ?&gt;</span></span>&quot; size=&quot;22&quot; tabindex=&quot;3&quot; /&gt;
  <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;&lt;<span style="color: #000000; font-weight: bold;">small</span>&gt;</span>Website<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">small</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">label</span>&gt;&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;">div</span>&gt;</span></pre></div></div>

</li>
<li>
<p>Connect the following jQuery script to your site (and also don&#8217;t forget to connect the jQuery framework, if it still isn&#8217;t connected):</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><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: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
  <span style="color: #003366; font-weight: bold;">var</span> author <span style="color: #339933;">=</span> $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#author'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">val</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span> author <span style="color: #339933;">!=</span><span style="color: #3366CC;">''</span> <span style="color: #339933;">&amp;&amp;</span> $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#email'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">val</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">!=</span><span style="color: #3366CC;">''</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#authorData'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">hide</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#authorData'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">before</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'&lt;div id=&quot;welcome&quot;&gt;Welcome back, &lt;strong&gt;'</span> <span style="color: #339933;">+</span> author <span style="color: #339933;">+</span> <span style="color: #3366CC;">'&lt;/strong&gt;! &lt;a href=&quot;#&quot;&gt;Edit &amp;raquo;&lt;/a&gt;&lt;/div&gt;'</span><span style="color: #009900;">&#41;</span>
    $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#welcome a'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">toggle</span><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;">'#authorData'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">show</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">300</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;">html</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'Minimize &amp;raquo;'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #339933;">;</span>
      <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</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;">'#authorData'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">hide</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">300</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;">html</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'Edit &amp;raquo;'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #003366; font-weight: bold;">false</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>
&nbsp;
<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: #009900;">&#40;</span>jQuery<span style="color: #009900;">&#41;</span></pre></div></div>

</li>
<li>That&#8217;s all.</li>
</ol>
<p>I think the commentators of you site will appreciate this feature ;0)</p>
]]></content:encoded>
			<wfw:commentRss>http://dimox.net/say-welcome-back-to-commentators-on-wordpress-using-jquery/feed/</wfw:commentRss>
		<slash:comments>25</slash:comments>
		</item>
		<item>
		<title>jQuery Comment Preview WordPress Plugin</title>
		<link>http://dimox.net/jquery-comment-preview-wordpress-plugin/</link>
		<comments>http://dimox.net/jquery-comment-preview-wordpress-plugin/#comments</comments>
		<pubDate>Mon, 05 Apr 2010 16:00:45 +0000</pubDate>
		<dc:creator>Dimox</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[comments]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[preview]]></category>

		<guid isPermaLink="false">http://dimox.net/?p=17</guid>
		<description><![CDATA[<strong>jQuery Comment Preview WordPress Plugin</strong> allows the live comment preview without page reboot. It works on jQuery.

Requires WordPress version: <strong>2.5 or higher</strong>.

You can see an example on a current site.]]></description>
			<content:encoded><![CDATA[<p><strong>jQuery Comment Preview WordPress Plugin</strong> allows the live comment preview without page reboot. It works on jQuery.</p>
<p>Requires WordPress version: <strong>2.9 or higher</strong>.</p>
<p>You can see an example on a current site.</p>
<h3>Plugin features</h3>
<ul>
<li>Live comment preview, which does not take that extra space on the page.</li>
<li>Simple HTML-editor (instructions on using the editor are on the plugin options page).</li>
<li>You can customize comment preview block as you wish. You can display: comment author name, avatar (static or dinamic using gravatar.com), comment date and time, comment text. All this can be designed with CSS.</li>
<li>You may don&#8217;t connect plugin&#8217;s CSS file (optional) if you wish to reduce number of queries to your server.</li>
<li>Plugin&#8217;s JS and CSS files are connected only on the pages with comment form.</li>
</ul>
<h3>Download</h3>
<p><strong style="color:red">Attention:</strong> knowledge of CSS and HTML may require for using a plugin.</p>
<div class="download">
<div class="dl">
<h3><a href="http://downloads.wordpress.org/plugin/jquery-comment-preview.zip">jQuery Comment Preview WordPress Plugin</a></h3>
<p>Version: <strong>0.5</strong> / Last updated: <strong>2011-09-10</strong></p>
<div class="leftFold"></div>
</div>
</div>
<h3>Installation</h3>
<ol>
<li>Upload <code>jquery-comment-preview</code> folder to the <code>/wp-content/plugins/</code> directory.</li>
<li>Activate the plugin through the &#8216;Plugins&#8217; menu in admin interface of WordPress.</li>
<li>If it&#8217;s necessary, you can customize options in admin interface at the <code>Options &rarr; jQuery Comment Preview</code> page.</li>
<li>If it&#8217;s necessary, you can edit CSS styles for comment preview block in the <code>jquery-comment-preview.css</code> file.</li>
<li>That&#8217;s all.</li>
</ol>
<h3>HTML code of preview block</h3>
<p>The plugin creates the following structure of HTML code for the preview block (this may be useful in the design through CSS):</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;jcpWrap&quot;</span>&gt;</span>
  <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;jcpToolbar&quot;</span>&gt;</span>
    <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;htmlEditor&quot;</span>&gt;</span>
      <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">a</span>&gt;</span>button<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;</span>
      <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">a</span>&gt;</span>button<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;</span>
      ...
    <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span>
    <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;previewTab&quot;</span>&gt;</span>Preview<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span>
  <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</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>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">textarea</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span></pre></div></div>

<h3>If nothing works</h3>
<ol>
<li>Make sure that you use the appropriate version of WordPress, which is required for a plugin work.</li>
<li>
<p>Make sure that the <code>header.php</code> file of your theme has the following code:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> wp_head<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>If not, insert it before the <code>&lt;/head&gt;</code> tag.</p>
</li>
<li>If the first 2 points are not solved the problem, give details in comments to this post.</li>
</ol>
<h3 id="versionHistory">Version history</h3>
<div id="history">
<ul>
<li><strong>Version 0.5</strong> (2011-09-10):
<ul>
<li>now if there is no selected text while inserting the URL, then a link itself becomes an anchor;</li>
<li>added ability to insert a link to an image through a dialog box.</li>
</ul>
</li>
<li><strong>Version 0.4</strong> (2011-03-19):
<ul>
<li>optimized jQuery script;</li>
<li>changed the names of identifiers of blocks, made appropriate changes in the CSS file;</li>
<li>fixed a bug when using the single quote in the translation file and in the template of preview block;</li>
<li>changed the default template of preview block;</li>
<li>the tag <code>&lt;script>&lt;/script></code> now cuts from the template of preview block;</li>
<li>modified the path to the jquery-comment-preview.js file;</li>
<li>minimized the md5.js file.</li>
</ul>
</li>
<li><strong>Version 0.3</strong> (2010-09-23):
<ul>
<li>this version works on <strong>WordPress 2.9 or higher</strong>;</li>
<li>fixed: plugin did not worked, if &#8220;WordPress address&#8221; and &#8220;Blog address&#8221; differed;</li>
<li>now you can use single quotes in the text of preview button;</li>
<li>added the &#8220;About the plugin&#8221; button;</li>
<li>optimized the system of settings.</li>
</ul>
</li>
<li><strong>Version 0.2</strong> (05.02.10):
<ul>
<li>text links in the preview now are clickable;</li>
<li>new option: &#8216;Add the target=&#8221;_blank&#8221; parameter to external links&#8217;;</li>
<li>new option: &#8216;Show button with WordPress smilies&#8217; &#8211; uses build-in WordPress smiles;</li>
<li>added French localization (thanks to <a href="http://www.wolforg.eu/" target="_blank">Wolforg</a>).</li>
</ul>
</li>
<li><strong>Version 0.1.7</strong> (03.18.10):
<ul>
<li>solved the problem, when preview did not work until the &#8220;Update Options&#8221; button not been pressed on a plugin options page;</li>
<li>jQuery 1.4.2 is now connected instead of jQuery 1.3.2.</li>
</ul>
</li>
<li><strong>Version 0.1.6</strong> (01.05.10):
<ul>
<li>solved the problem, when a tags have been inserted incorrectly in Internet Explorer when using the HTML editor;</li>
<li>adding a link now works like in WordPress HTML editor &#8211; when &#8216;link&#8217; button is clicked, there appear a window for entering a URL.</li>
</ul>
</li>
<li><strong>Version 0.1.5</strong> (12.20.09):
<ul>
<li>the design of preview panel has been changed. Now it looks like WordPress HTML editor;</li>
<li>the structure of the template of the HTML editor has been changed;</li>
<li>the script connects now to the <code>name</code> parameter of the <code>textarea</code> tag, but not to <code>id</code>;</li>
<li>solved the problem, when in some cases preview did not work;</li>
<li>the plugin&#8217;s JS and CSS files connects now in the <code>head</code> section of the page code;</li>
<li>jQuery now comes from Google.</li>
</ul>
</li>
<li><strong>Version 0.1.4</strong> (06.20.09):
<ul>
<li>added ability to indicate the value of the <code>id</code> acoderibute of the <code>textarea</code> tag;</li>
<li>added ability to insert comment date and time in preview block template;</li>
<li>added the option for displaying avatars from gravatar.com.</li>
</ul>
</li>
<li><strong>Version 0.1.3</strong> (02.07.09):
<ul>
<li>fine-tuned filters of text formacodeing in preview;</li>
<li>deleted automatic ficodeing the width of the preview panel under width of a <code>&lt;textarea&gt;</code> field, now need to change its width through CSS, for this you need to play once with the <code>width</code> parameter of <code>#jquery-comment-wrap</code> and <code>#jquery-comment-preview</code> identifiers, which are in the <code>jquery-comment-preview.css</code> file.</li>
</ul>
</li>
<li><strong>Version 0.1.2</strong> (12.19.08): the changes associated with incorrect display of the comment form in Internet Explorer on some WordPress themes.</li>
<li><strong>Version 0.1.1</strong> (12.17.08): fixed bug: the comment can not be submited.</li>
<li><strong>Version 0.1</strong> (12.16.08): the initial version.</li>
</ul>
</div>
<p><!-- #history --></p>
]]></content:encoded>
			<wfw:commentRss>http://dimox.net/jquery-comment-preview-wordpress-plugin/feed/</wfw:commentRss>
		<slash:comments>155</slash:comments>
		</item>
		<item>
		<title>Simplest Universal jQuery Tabs Script</title>
		<link>http://dimox.net/simplest-universal-jquery-tabs-script/</link>
		<comments>http://dimox.net/simplest-universal-jquery-tabs-script/#comments</comments>
		<pubDate>Thu, 04 Mar 2010 10:46:38 +0000</pubDate>
		<dc:creator>Dimox</dc:creator>
				<category><![CDATA[jQuery]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[tabs]]></category>

		<guid isPermaLink="false">http://dimox.net/?p=15</guid>
		<description><![CDATA[My experience with jQuery for today is about 2 years. I began to learn this nice framework after I found somewhere in Internet a script, which lets to create a tabbed blocks.

During this 2 years I gained my experience in jQuery and <strong>created my own jQuery Tabs Script</strong> completely from scratch. And I want to share it with you in this post.]]></description>
			<content:encoded><![CDATA[<p>My experience with jQuery for today is about 2 years. I began to learn this nice framework after I found somewhere in Internet a script, which lets to create a tabbed blocks.</p>
<p>During this 2 years I gained my experience in jQuery and <strong>created my own jQuery Tabs Script</strong> completely from scratch. And I want to share it with you in this post.</p>
<p>I call it an <strong>universal</strong>, because it lets to create an unlimited number of tabbed blocks with an unlimited number of tabs, while the contents of the script remains unchanged (script size is <strong>only 0.4 kilobytes</strong>).</p>
<h3>jQuery Tabs Script code</h3>
<p>In my opinion, I&#8217;ve made a miniature and pretty jQuery script for a tabs:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;"><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: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
  $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'ul.tabs'</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><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</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;">find</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'li'</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>i<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</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;">click</span><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: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">addClass</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'current'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">siblings</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">removeClass</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'current'</span><span style="color: #009900;">&#41;</span>
          .<span style="color: #660066;">parents</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'div.section'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">find</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'div.box'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">hide</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">end</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">find</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'div.box:eq('</span><span style="color: #339933;">+</span>i<span style="color: #339933;">+</span><span style="color: #3366CC;">')'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">fadeIn</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">150</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>
    <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>
&nbsp;
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#40;</span>jQuery<span style="color: #009900;">&#41;</span></pre></td></tr></table></div>

<p>The following script doing the same as the code above, but this script is yet smaller (note that it require jQuery at least version 1.4.2):</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;"><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: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
   $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'ul.tabs'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">delegate</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'li:not(.current)'</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">'click'</span><span style="color: #339933;">,</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: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">addClass</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'current'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">siblings</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">removeClass</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'current'</span><span style="color: #009900;">&#41;</span>
       .<span style="color: #660066;">parents</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'div.section'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">find</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'div.box'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">hide</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">eq</span><span style="color: #009900;">&#40;</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;">index</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">fadeIn</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">150</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
   <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span>
&nbsp;
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#40;</span>jQuery<span style="color: #009900;">&#41;</span></pre></td></tr></table></div>

<h3>HTML code for the script</h3>
<p>It very similar on a structure of HTML code of another jQuery tabs solutions, which I was seen:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
</pre></td><td class="code"><pre class="html" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;section&quot;</span>&gt;</span>
  <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">ul</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;tabs&quot;</span>&gt;</span>
    <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;current&quot;</span>&gt;</span>First Tab<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
    <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;</span>Second Tab<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
  <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">ul</span>&gt;</span>
  <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;box visible&quot;</span>&gt;</span>
    Content of the first block
  <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span>
  <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;box&quot;</span>&gt;</span>
    Content of the second block
  <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span><span style="color: #808080; font-style: italic;">&lt;!-- .section --&gt;</span></pre></td></tr></table></div>

<h3>Requied CSS for this HTML</h3>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
</pre></td><td class="code"><pre class="css" style="font-family:monospace;"><span style="color: #6666ff;">.box</span> <span style="color: #00AA00;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">display</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">none</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
<span style="color: #6666ff;">.box</span><span style="color: #6666ff;">.visible</span> <span style="color: #00AA00;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">display</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">block</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></td></tr></table></div>

<p>The <code>.box</code> class hides all tabbed blocks by default, but the <code>.visible</code> shows the desired block.</p>
<div class="download">
<div class="dl">
<h3><a href="http://dimox.net/demo/simplest-universal-jquery-tabs-script.zip">Download Demo Files</a></h3>
<div class="demo"><a href="http://dimox.net/demo/simplest-universal-jquery-tabs-script/">View Demo Online</a></div>
<div class="leftFold"></div>
</div>
</div>
<p><strong>P.S.</strong>. Yes, perhaps I invented the wheel, but i get great pleasure from this process and simultaneously improve my experience in jQuery, and I don&#8217;t think this is so bad.</p>
]]></content:encoded>
			<wfw:commentRss>http://dimox.net/simplest-universal-jquery-tabs-script/feed/</wfw:commentRss>
		<slash:comments>41</slash:comments>
		</item>
		<item>
		<title>jQuery: Switching The Focus Between Two Form Fields</title>
		<link>http://dimox.net/jquery-switching-the-focus-between-two-form-fields/</link>
		<comments>http://dimox.net/jquery-switching-the-focus-between-two-form-fields/#comments</comments>
		<pubDate>Mon, 01 Feb 2010 14:46:06 +0000</pubDate>
		<dc:creator>Dimox</dc:creator>
				<category><![CDATA[jQuery]]></category>
		<category><![CDATA[form]]></category>
		<category><![CDATA[script]]></category>

		<guid isPermaLink="false">http://dimox.net/?p=14</guid>
		<description><![CDATA[In the last version of my <a href="http://widgets.opera.com/widget/13162/" target="_blank">Google Translator</a> widget for Opera I had to solve one problem - how to switch the focus between two <code>textarea</code>s by clicking on a hotkey.

In this article I want to share jQuery script, that solves this problem. May be it will be usefull for someone.]]></description>
			<content:encoded><![CDATA[<p>In the last version of my <a href="http://widgets.opera.com/widget/13162/" target="_blank">Google Translator</a> widget for Opera I had to solve one problem &#8211; how to switch the focus between two <code>textarea</code>s by clicking on a hotkey.</p>
<p>In this article I want to share jQuery script, that solves this problem. May be it will be usefull for someone.</p>
<p>What is interesting, while I wrote this post and have tested the script, I reduced its size about 2.5 times compared with the original version (this suggests that the same problem can be solved in different ways and always need to try to optimize JavaScript scripts).</p>
<p>Now lets look at the script:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;">$<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>
&nbsp;
  <span style="color: #009966; font-style: italic;">/* Adding a class to TEXTAREA to determine the focus */</span>
  $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'textarea'</span><span style="color: #009900;">&#41;</span>.<span style="color: #000066;">focus</span><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;">'textarea'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">removeClass</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'hasFocus'</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;">addClass</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'hasFocus'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span>
&nbsp;
  <span style="color: #009966; font-style: italic;">/* Putting the focus by default on a first TEXTAREA */</span>
  $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#textarea1'</span><span style="color: #009900;">&#41;</span>.<span style="color: #000066;">focus</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #009966; font-style: italic;">/* Switching the focus by clicking Enter */</span>
  $<span style="color: #009900;">&#40;</span>document<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">keypress</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>e<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>e.<span style="color: #660066;">which</span> <span style="color: #339933;">==</span> <span style="color: #CC0000;">13</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'textarea'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">not</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'.hasFocus'</span><span style="color: #009900;">&#41;</span>.<span style="color: #000066;">focus</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
  <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span>
&nbsp;
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span></pre></td></tr></table></div>

<p>What we doing in this script? We add the <code>.hasFocus</code> class to the focused textarea, remove this class from a field that is not focused, and while pressing <code>Enter</code> focus switches to a textarea, that has no this class.</p>
<p>May be there is a shorter way to do the same, but, unfortunately, I not found simpler way to get a field, that has not the focus.</p>
<h3>Demo</h3>
<p>Look at the <a href="http://dimox.net/demo/jquery-switching-the-focus-between-two-form-fields.html">script in action</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://dimox.net/jquery-switching-the-focus-between-two-form-fields/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

