adding classes to element
<p>In the code below,do after method generate new jquery object .If not ,why addClass method is addind class 'foo' on both the <em>div</em> as well as <em>p</em> element</p>

<pre><code>$('&lt;div/&gt;').after('&lt;p&gt;&lt;/p&gt;').addClass('foo')
  .filter('p').attr('id', 'bar').html('hello')
.end()
.appendTo('body');
</code></pre>
