Dave,

Think about it this way - you wanted to find class "a" - it found an
element with class "a" and so returned it back to you. This is
different than the className() method, which is not asking for class
"a" - it is asking for the class name of the element with class "a"
that you wanted to find. Both have their benefits and uses.

Brian


On May 5, 6:08 am, Jörn Zaefferer <[EMAIL PROTECTED]> wrote:
> DaveG schrieb:
>
> >> Am I just going the wrong way? Should I switch to normal loop, or an
> >> each loop? Comments?
> > $(".a")
> >    .each(function(i){
> >       $(this).wrap('<div class="outter ' +$(this).attr("class")+
> > '"></div>')
> >       .removeClass().addClass("z");
> > });
>
> > Here's my attempt. It works. Is there a better/different way, perhaps
> > not using the each, but simply chaining?
>
> attr() accepts a function as the value-argument. That may allow you to
> get rid of the each-call, but you need a function anyway.
>
> --
> Jörn Zaefferer
>
> http://bassistance.de

Reply via email to