[jQuery] Re: Getting the full class set of the current object

2007-05-05 Thread Giant Jam Sandwich
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 fin

[jQuery] Re: Getting the full class set of the current object

2007-05-05 Thread Jörn Zaefferer
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(''">') .removeClass().addClass("z"); }); Here's my attempt. It works. Is there a better/different way, perhaps not using the each,

[jQuery] Re: Getting the full class set of the current object

2007-05-04 Thread DaveG
Am I just going the wrong way? Should I switch to normal loop, or an each loop? Comments? $(".a") .each(function(i){ $(this).wrap(''">') .removeClass().addClass("z"); }); Here's my attempt. It works. Is there a better/different way, perhaps not using the each, but simply chain

[jQuery] Re: Getting the full class set of the current object

2007-05-04 Thread DaveG
Jörn Zaefferer wrote: Sam Collett schrieb: $('.a')[0].className should work That doesn't explain why .attr('class') should not work. I've given that a quick try and I have no problems, it returns both classes. Looks like my test case wasn't specific enough. When more than one object matc

[jQuery] Re: Getting the full class set of the current object

2007-05-04 Thread Jörn Zaefferer
Sam Collett schrieb: > $('.a')[0].className should work > That doesn't explain why .attr('class') should not work. I've given that a quick try and I have no problems, it returns both classes. -- Jörn Zaefferer http://bassistance.de --~--~-~--~~~---~--~~ You

[jQuery] Re: Getting the full class set of the current object

2007-05-04 Thread Sam Collett
$('.a')[0].className should work On May 4, 4:01 am, DaveG <[EMAIL PROTECTED]> wrote: > Given: > > Running: $('.a').attr('class') > > Returns: "a" > > I expected "a b". How do I obtain the full class set applied to the > current object? > > ~ ~ Dave