<?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/"
		>
<channel>
	<title>Comments on: How to Get Anything You Want &#8211; part 2</title>
	<atom:link href="http://www.learningjquery.com/2006/12/how-to-get-anything-you-want-part-2/feed" rel="self" type="application/rss+xml" />
	<link>http://www.learningjquery.com/2006/12/how-to-get-anything-you-want-part-2</link>
	<description>Tips, techniques, and tutorials for the jQuery JavaScript library</description>
	<lastBuildDate>Mon, 15 Mar 2010 11:26:21 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Karl Swedberg</title>
		<link>http://www.learningjquery.com/2006/12/how-to-get-anything-you-want-part-2/comment-page-1#comment-78140</link>
		<dc:creator>Karl Swedberg</dc:creator>
		<pubDate>Fri, 14 Aug 2009 12:49:10 +0000</pubDate>
		<guid isPermaLink="false">http://www.learningjquery.com/2006/12/how-to-get-anything-you-want-part-2#comment-78140</guid>
		<description>&lt;code&gt;$(&#039;#table1 td.class-one.class-two&#039;)&lt;/code&gt;</description>
		<content:encoded><![CDATA[<p><code>$('#table1 td.class-one.class-two')</code></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: JQuery Tip – 2: filter vs find &#171; SANDBOX&#8230;&#8230;.</title>
		<link>http://www.learningjquery.com/2006/12/how-to-get-anything-you-want-part-2/comment-page-1#comment-73066</link>
		<dc:creator>JQuery Tip – 2: filter vs find &#171; SANDBOX&#8230;&#8230;.</dc:creator>
		<pubDate>Sun, 17 May 2009 12:29:14 +0000</pubDate>
		<guid isPermaLink="false">http://www.learningjquery.com/2006/12/how-to-get-anything-you-want-part-2#comment-73066</guid>
		<description>[...] For more reading on this topic, How to Get Anything You Want &#8211; part 2 [...]</description>
		<content:encoded><![CDATA[<p>[...] For more reading on this topic, How to Get Anything You Want &#8211; part 2 [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: JQuery Tip – 2: Filter VS Find &#171; SANDBOX&#8230;&#8230;.</title>
		<link>http://www.learningjquery.com/2006/12/how-to-get-anything-you-want-part-2/comment-page-1#comment-73065</link>
		<dc:creator>JQuery Tip – 2: Filter VS Find &#171; SANDBOX&#8230;&#8230;.</dc:creator>
		<pubDate>Sun, 17 May 2009 12:16:58 +0000</pubDate>
		<guid isPermaLink="false">http://www.learningjquery.com/2006/12/how-to-get-anything-you-want-part-2#comment-73065</guid>
		<description>[...] For more reading, How to Get Anything You Want &#8211; part 2 [...]</description>
		<content:encoded><![CDATA[<p>[...] For more reading, How to Get Anything You Want &#8211; part 2 [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: sayed khalid sultani</title>
		<link>http://www.learningjquery.com/2006/12/how-to-get-anything-you-want-part-2/comment-page-1#comment-72872</link>
		<dc:creator>sayed khalid sultani</dc:creator>
		<pubDate>Thu, 23 Apr 2009 13:18:57 +0000</pubDate>
		<guid isPermaLink="false">http://www.learningjquery.com/2006/12/how-to-get-anything-you-want-part-2#comment-72872</guid>
		<description>hi how can we check for td with 2 classes with different class name in single tr ,thanks 
&lt;code&gt;$(&#039;#table1 tr .abc )&lt;/code&gt;</description>
		<content:encoded><![CDATA[<p>hi how can we check for td with 2 classes with different class name in single tr ,thanks<br />
<code>$('#table1 tr .abc )</code></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Erik</title>
		<link>http://www.learningjquery.com/2006/12/how-to-get-anything-you-want-part-2/comment-page-1#comment-63944</link>
		<dc:creator>Erik</dc:creator>
		<pubDate>Fri, 16 Jan 2009 18:07:46 +0000</pubDate>
		<guid isPermaLink="false">http://www.learningjquery.com/2006/12/how-to-get-anything-you-want-part-2#comment-63944</guid>
		<description>Fantastic, thanks Karl!
I didn&#039;t realize their is an &quot;each&quot; function. That is so cool.
It worked.</description>
		<content:encoded><![CDATA[<p>Fantastic, thanks Karl!<br />
I didn&#8217;t realize their is an &#8220;each&#8221; function. That is so cool.<br />
It worked.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Karl Swedberg</title>
		<link>http://www.learningjquery.com/2006/12/how-to-get-anything-you-want-part-2/comment-page-1#comment-63943</link>
		<dc:creator>Karl Swedberg</dc:creator>
		<pubDate>Fri, 16 Jan 2009 17:18:19 +0000</pubDate>
		<guid isPermaLink="false">http://www.learningjquery.com/2006/12/how-to-get-anything-you-want-part-2#comment-63943</guid>
		<description>No problem, Erik. Try this:
&lt;pre&gt;&lt;code&gt;$(&#039;div.myclass&#039;).each(function() {
  $(this).children(&#039;p:lt(3)&#039;).addClass(&#039;newclass&#039;);
});
&lt;/code&gt;&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>No problem, Erik. Try this:</p>
<pre><code>$('div.myclass').each(function() {
  $(this).children('p:lt(3)').addClass('newclass');
});
</code></pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: Erik</title>
		<link>http://www.learningjquery.com/2006/12/how-to-get-anything-you-want-part-2/comment-page-1#comment-63942</link>
		<dc:creator>Erik</dc:creator>
		<pubDate>Fri, 16 Jan 2009 16:07:53 +0000</pubDate>
		<guid isPermaLink="false">http://www.learningjquery.com/2006/12/how-to-get-anything-you-want-part-2#comment-63942</guid>
		<description>I&#039;m sorry, my jquery actually is this:
&lt;code&gt;$(&#039;.myclass&#039;).children(&#039;p:lt(3)&#039;).addClass(&#039;newclass&#039;);&lt;/code&gt;</description>
		<content:encoded><![CDATA[<p>I&#8217;m sorry, my jquery actually is this:<br />
<code>$('.myclass').children('p:lt(3)').addClass('newclass');</code></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Erik</title>
		<link>http://www.learningjquery.com/2006/12/how-to-get-anything-you-want-part-2/comment-page-1#comment-63941</link>
		<dc:creator>Erik</dc:creator>
		<pubDate>Fri, 16 Jan 2009 16:03:26 +0000</pubDate>
		<guid isPermaLink="false">http://www.learningjquery.com/2006/12/how-to-get-anything-you-want-part-2#comment-63941</guid>
		<description>Karl,
I see you have been such a big help to everyone here! Thank you for that!

I have a small issue I&#039;m trying to figure out. I apologize for the length of this comment in advance.
I want to add a class to the first 3 &#039;p&#039; in my divs on a page. And there are never the same amount of &quot;p&quot;s in the divs.
The HTML looks something like this.

&lt;div class=&quot;myclass&quot;&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;myclass&quot;&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;myclass&quot;&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;/div&gt;...


jquery I have so far is...
&lt;code&gt;$(&#039;.naetext&#039;).children(&#039;p:lt(3)&#039;).addClass(&#039;newclass&#039;);&lt;/code&gt;

What this does is it adds a class of &quot;newclass&quot; to the first 3 &quot;p&quot;s consecutively and not the first 3 of each &quot;set&quot; of &quot;p&quot;s
So my HTML looks like this

&lt;div class=&quot;myclass&quot;&gt;
&lt;p class=&quot;newclass&quot;&gt;&lt;/p&gt;         added class 1
&lt;p class=&quot;newclass&quot;&gt;&lt;/p&gt;         added class 2
&lt;/div&gt;
&lt;div class=&quot;myclass&quot;&gt;
&lt;p class=&quot;newclass&quot;&gt;&lt;/p&gt;         added class 3
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;myclass&quot;&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;/div&gt;

What I need is this...
&lt;div class=&quot;myclass&quot;&gt;
&lt;p class=&quot;newclass&quot;&gt;&lt;/p&gt;         added class 1
&lt;p class=&quot;newclass&quot;&gt;&lt;/p&gt;         added class 2
&lt;/div&gt;
&lt;div class=&quot;myclass&quot;&gt;
&lt;p class=&quot;newclass&quot;&gt;&lt;/p&gt;         added class 1
&lt;p class=&quot;newclass&quot;&gt;&lt;/p&gt;         added class 2
&lt;p class=&quot;newclass&quot;&gt;&lt;/p&gt;         added class 3
&lt;/div&gt;
&lt;div class=&quot;myclass&quot;&gt;
&lt;p class=&quot;newclass&quot;&gt;&lt;/p&gt;         added class 1
&lt;p class=&quot;newclass&quot;&gt;&lt;/p&gt;         added class 2
&lt;p class=&quot;newclass&quot;&gt;&lt;/p&gt;         added class 3
&lt;p&gt;&lt;/p&gt;
&lt;/div&gt;

Man, I hope that makes sense. I appreciate your time!</description>
		<content:encoded><![CDATA[<p>Karl,<br />
I see you have been such a big help to everyone here! Thank you for that!</p>
<p>I have a small issue I&#8217;m trying to figure out. I apologize for the length of this comment in advance.<br />
I want to add a class to the first 3 &#8216;p&#8217; in my divs on a page. And there are never the same amount of &#8220;p&#8221;s in the divs.<br />
The HTML looks something like this.</p>
<p>&lt;div class=&#8221;myclass&#8221;&gt;<br />
&lt;p&gt;&lt;/p&gt;<br />
&lt;p&gt;&lt;/p&gt;<br />
&lt;/div&gt;<br />
&lt;div class=&#8221;myclass&#8221;&gt;<br />
&lt;p&gt;&lt;/p&gt;<br />
&lt;p&gt;&lt;/p&gt;<br />
&lt;p&gt;&lt;/p&gt;<br />
&lt;/div&gt;<br />
&lt;div class=&#8221;myclass&#8221;&gt;<br />
&lt;p&gt;&lt;/p&gt;<br />
&lt;p&gt;&lt;/p&gt;<br />
&lt;p&gt;&lt;/p&gt;<br />
&lt;p&gt;&lt;/p&gt;<br />
&lt;/div&gt;&#8230;</p>
<p>jquery I have so far is&#8230;<br />
<code>$('.naetext').children('p:lt(3)').addClass('newclass');</code></p>
<p>What this does is it adds a class of &#8220;newclass&#8221; to the first 3 &#8220;p&#8221;s consecutively and not the first 3 of each &#8220;set&#8221; of &#8220;p&#8221;s<br />
So my HTML looks like this</p>
<p>&lt;div class=&#8221;myclass&#8221;&gt;<br />
&lt;p class=&#8221;newclass&#8221;&gt;&lt;/p&gt;         added class 1<br />
&lt;p class=&#8221;newclass&#8221;&gt;&lt;/p&gt;         added class 2<br />
&lt;/div&gt;<br />
&lt;div class=&#8221;myclass&#8221;&gt;<br />
&lt;p class=&#8221;newclass&#8221;&gt;&lt;/p&gt;         added class 3<br />
&lt;p&gt;&lt;/p&gt;<br />
&lt;p&gt;&lt;/p&gt;<br />
&lt;/div&gt;<br />
&lt;div class=&#8221;myclass&#8221;&gt;<br />
&lt;p&gt;&lt;/p&gt;<br />
&lt;p&gt;&lt;/p&gt;<br />
&lt;p&gt;&lt;/p&gt;<br />
&lt;p&gt;&lt;/p&gt;<br />
&lt;/div&gt;</p>
<p>What I need is this&#8230;<br />
&lt;div class=&#8221;myclass&#8221;&gt;<br />
&lt;p class=&#8221;newclass&#8221;&gt;&lt;/p&gt;         added class 1<br />
&lt;p class=&#8221;newclass&#8221;&gt;&lt;/p&gt;         added class 2<br />
&lt;/div&gt;<br />
&lt;div class=&#8221;myclass&#8221;&gt;<br />
&lt;p class=&#8221;newclass&#8221;&gt;&lt;/p&gt;         added class 1<br />
&lt;p class=&#8221;newclass&#8221;&gt;&lt;/p&gt;         added class 2<br />
&lt;p class=&#8221;newclass&#8221;&gt;&lt;/p&gt;         added class 3<br />
&lt;/div&gt;<br />
&lt;div class=&#8221;myclass&#8221;&gt;<br />
&lt;p class=&#8221;newclass&#8221;&gt;&lt;/p&gt;         added class 1<br />
&lt;p class=&#8221;newclass&#8221;&gt;&lt;/p&gt;         added class 2<br />
&lt;p class=&#8221;newclass&#8221;&gt;&lt;/p&gt;         added class 3<br />
&lt;p&gt;&lt;/p&gt;<br />
&lt;/div&gt;</p>
<p>Man, I hope that makes sense. I appreciate your time!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Karl Swedberg</title>
		<link>http://www.learningjquery.com/2006/12/how-to-get-anything-you-want-part-2/comment-page-1#comment-63940</link>
		<dc:creator>Karl Swedberg</dc:creator>
		<pubDate>Fri, 16 Jan 2009 13:50:15 +0000</pubDate>
		<guid isPermaLink="false">http://www.learningjquery.com/2006/12/how-to-get-anything-you-want-part-2#comment-63940</guid>
		<description>Sure, you could do something like this:
&lt;pre&gt;&lt;code&gt;var childIds = [];
$(&#039;#mydiv&#039;).children().each(function() {
  childIds.push(this.id);
});
&lt;/code&gt;&lt;/pre&gt;

Or, you could use the &lt;code&gt;.map()&lt;/code&gt; method:
&lt;pre&gt;&lt;code&gt;var childIds = $(&#039;#mydiv&#039;).children().map(function() {
  return this.id;
}).get();
&lt;/code&gt;&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>Sure, you could do something like this:</p>
<pre><code>var childIds = [];
$('#mydiv').children().each(function() {
  childIds.push(this.id);
});
</code></pre>
<p>Or, you could use the <code>.map()</code> method:</p>
<pre><code>var childIds = $('#mydiv').children().map(function() {
  return this.id;
}).get();
</code></pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bala</title>
		<link>http://www.learningjquery.com/2006/12/how-to-get-anything-you-want-part-2/comment-page-1#comment-63939</link>
		<dc:creator>Bala</dc:creator>
		<pubDate>Fri, 16 Jan 2009 13:22:46 +0000</pubDate>
		<guid isPermaLink="false">http://www.learningjquery.com/2006/12/how-to-get-anything-you-want-part-2#comment-63939</guid>
		<description>is it possible to get the id&#039;s of all the children of  an element and throw it into an array, or use it in a loop?
I am dynamically adding &#039;a&#039; tags with unique id&#039;s inside a div, and for each a tag I want to init a plugin like lightbox. I hope this makes sense...</description>
		<content:encoded><![CDATA[<p>is it possible to get the id&#8217;s of all the children of  an element and throw it into an array, or use it in a loop?<br />
I am dynamically adding &#8216;a&#8217; tags with unique id&#8217;s inside a div, and for each a tag I want to init a plugin like lightbox. I hope this makes sense&#8230;</p>
]]></content:encoded>
	</item>
</channel>
</rss>
