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
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,
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
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
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
$('.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
6 matches
Mail list logo