It depends on what class you want to use.

target = $("div").attr("class").split(" ")

Now if I know what class I want to use, I would choose that one. But since
thats not the probable case, lets say

$.each(target, function(cls) { $("p").filter("." + cls).doSomething();});

Probably that helps. If that doesn't please reframe your question throwing
more light on requirement.

On Sun, Jan 25, 2009 at 2:43 AM, cherry.aus...@gmail.com <
cherry.aus...@gmail.com> wrote:

>
> I'm getting all knotted up on this!
>
> I'm looking to use one class, from an element with several, as a
> selector.
> Example:
>
> <div class="red tiny bold">
> <p class="tiny">
>
> target = $( 'div' ).attr( 'class' );
> // get 'tiny' from returned value
> $( "'p." + target + "'" ).doSomething();
>
> How to I get jQuery to pick out just the class I need?
>
>


-- 
Thanks
Ram

Reply via email to