<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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:series="http://unfoldingneurons.com/"
		>
<channel>
	<title>Comments on: Looping with jQuery</title>
	<atom:link href="http://www.svennerberg.com/2008/08/looping-with-jquery/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.svennerberg.com/2008/08/looping-with-jquery/</link>
	<description>A blog about web developement and usability.</description>
	<lastBuildDate>Sat, 04 Sep 2010 16:35:03 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
	<item>
		<title>By: Gabriel Svennerberg</title>
		<link>http://www.svennerberg.com/2008/08/looping-with-jquery/comment-page-1/#comment-16151</link>
		<dc:creator>Gabriel Svennerberg</dc:creator>
		<pubDate>Fri, 20 Aug 2010 16:31:17 +0000</pubDate>
		<guid isPermaLink="false">http://www.svennerberg.com/?p=174#comment-16151</guid>
		<description>&lt;strong&gt;Santosh:&lt;/strong&gt; It&#039;s easy, you just add 1 to i each iteration. 

&lt;pre&gt;
$(&#039;#my_list li&#039;).each(function(i) {
  $(this).append(i + 1);
});
&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p><strong>Santosh:</strong> It&#8217;s easy, you just add 1 to i each iteration. </p>
<pre>
$('#my_list li').each(function(i) {
  $(this).append(i + 1);
});
</pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: santosh</title>
		<link>http://www.svennerberg.com/2008/08/looping-with-jquery/comment-page-1/#comment-16138</link>
		<dc:creator>santosh</dc:creator>
		<pubDate>Thu, 19 Aug 2010 18:58:04 +0000</pubDate>
		<guid isPermaLink="false">http://www.svennerberg.com/?p=174#comment-16138</guid>
		<description>$(&#039;#my_list li&#039;).each(function(i) {
	$(this).append(i.toString());
});

    * Item0
    * Item1
    * Item2

Instead i want to get
    * Item1
    * Item2
    * Item3

How to achieve the same???</description>
		<content:encoded><![CDATA[<p>$(&#8216;#my_list li&#8217;).each(function(i) {<br />
	$(this).append(i.toString());<br />
});</p>
<p>    * Item0<br />
    * Item1<br />
    * Item2</p>
<p>Instead i want to get<br />
    * Item1<br />
    * Item2<br />
    * Item3</p>
<p>How to achieve the same???</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Gabriel Svennerberg</title>
		<link>http://www.svennerberg.com/2008/08/looping-with-jquery/comment-page-1/#comment-10021</link>
		<dc:creator>Gabriel Svennerberg</dc:creator>
		<pubDate>Mon, 23 Nov 2009 07:33:12 +0000</pubDate>
		<guid isPermaLink="false">http://www.svennerberg.com/?p=174#comment-10021</guid>
		<description>&lt;strong&gt;&lt;em&gt;Michel:&lt;/em&gt;&lt;/strong&gt; There&#039;s almost always an elegant solution in jQuery! Got to love it! One thing to be aware of though is that if performance is an issue, you are better of with regular for-loops.</description>
		<content:encoded><![CDATA[<p><strong><em>Michel:</em></strong> There&#8217;s almost always an elegant solution in jQuery! Got to love it! One thing to be aware of though is that if performance is an issue, you are better of with regular for-loops.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Michel Moos</title>
		<link>http://www.svennerberg.com/2008/08/looping-with-jquery/comment-page-1/#comment-9997</link>
		<dc:creator>Michel Moos</dc:creator>
		<pubDate>Sun, 22 Nov 2009 02:46:53 +0000</pubDate>
		<guid isPermaLink="false">http://www.svennerberg.com/?p=174#comment-9997</guid>
		<description>ps: My implementation:
&lt;pre&gt;
var apptDetails=&#039;undefined&#039;;
function get_selected_values() {
  jQuery(document).ready(function($) {
    apptDetails=&#039;&#039; + &quot;\n&quot;;
    $(&quot;select&quot;).each(function(i){
      var v=$(this).val();
      if (v != &#039;none selected&#039;) {
        apptDetails = apptDetails + v + &quot;\n&quot;;
      }; 
    });  
  });
}
&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>ps: My implementation:</p>
<pre>
var apptDetails='undefined';
function get_selected_values() {
  jQuery(document).ready(function($) {
    apptDetails='' + "\n";
    $("select").each(function(i){
      var v=$(this).val();
      if (v != 'none selected') {
        apptDetails = apptDetails + v + "\n";
      };
    });
  });
}
</pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: Michel Moos</title>
		<link>http://www.svennerberg.com/2008/08/looping-with-jquery/comment-page-1/#comment-9996</link>
		<dc:creator>Michel Moos</dc:creator>
		<pubDate>Sun, 22 Nov 2009 02:45:15 +0000</pubDate>
		<guid isPermaLink="false">http://www.svennerberg.com/?p=174#comment-9996</guid>
		<description>Thank you for this!! (I knew there was an elegant solution.)</description>
		<content:encoded><![CDATA[<p>Thank you for this!! (I knew there was an elegant solution.)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Gabriel Svennerberg</title>
		<link>http://www.svennerberg.com/2008/08/looping-with-jquery/comment-page-1/#comment-1231</link>
		<dc:creator>Gabriel Svennerberg</dc:creator>
		<pubDate>Wed, 07 Jan 2009 21:24:29 +0000</pubDate>
		<guid isPermaLink="false">http://www.svennerberg.com/?p=174#comment-1231</guid>
		<description>I think that there&#039;s a fundamental flaw in your code. Surely you want the class to be appended only when the mouse hovers over it? In that case you could write it like this, but it&#039;s actually longer than your code :-)

&lt;pre&gt;
$(&#039;#my_list li&#039;).each(function() {
    $(this).hover(function() {
        $(this).addClass(&#039;selected&#039;);    
    },
    function() {
      $(this).removeClass(&#039;selected&#039;);  
    });
});
&lt;/pre&gt;

But on the other hand it&#039;s better to achieve this with pure CSS. Then it gets really short.

&lt;pre&gt;
#my_list li:hover {
    /* Whatever style you want it to have */
}
&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>I think that there&#8217;s a fundamental flaw in your code. Surely you want the class to be appended only when the mouse hovers over it? In that case you could write it like this, but it&#8217;s actually longer than your code <img src='http://www.svennerberg.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<pre>
$('#my_list li').each(function() {
    $(this).hover(function() {
        $(this).addClass('selected');
    },
    function() {
      $(this).removeClass('selected');
    });
});
</pre>
<p>But on the other hand it&#8217;s better to achieve this with pure <acronym title="Cascading Style Sheets">CSS</acronym>. Then it gets really short.</p>
<pre>
#my_list li:hover {
    /* Whatever style you want it to have */
}
</pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ro</title>
		<link>http://www.svennerberg.com/2008/08/looping-with-jquery/comment-page-1/#comment-1230</link>
		<dc:creator>Ro</dc:creator>
		<pubDate>Wed, 07 Jan 2009 20:34:39 +0000</pubDate>
		<guid isPermaLink="false">http://www.svennerberg.com/?p=174#comment-1230</guid>
		<description>Thanks for the article... helped me do this:

-------------------------------------
  $(&#039;#my_list li&#039;).each(function()
  {   
   $(this).mouseover(function()
   {
    $(&#039;#my_list li&#039;).removeClass(&quot;selected&quot;);
   
    $(this).addClass(&quot;selected&quot;);
    })
  })
-----------------------------------

Can you think of anyway to shorten this?

Thanks</description>
		<content:encoded><![CDATA[<p>Thanks for the article&#8230; helped me do this:</p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
  $(&#8216;#my_list li&#8217;).each(function()<br />
  {<br />
   $(this).mouseover(function()<br />
   {<br />
    $(&#8216;#my_list li&#8217;).removeClass(&#8220;selected&#8221;);</p>
<p>    $(this).addClass(&#8220;selected&#8221;);<br />
    })<br />
  })<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</p>
<p>Can you think of anyway to shorten this?</p>
<p>Thanks</p>
]]></content:encoded>
	</item>
</channel>
</rss>
