jQuery: The Write Less, Do More JavaScript Library

 « Return to Thread: how i can access classes in my div?

Re: how i can access classes in my div?

by luciano mazzetto :: Rate this Message:

Reply to Author | View in Thread

all OK. thanks

On Wed, May 14, 2008 at 5:02 AM, andrea varnier <andrea.varnier@...> wrote:

On 13 Mag, 16:29, canadaduane <duane.john...@...> wrote:
> I wonder if you're looking for 'filter' instead of 'next'?
>
> $('.bloc-top').click(function(){
>   $(this).filter('.bloc-center').slideToggle('slow');
> });

well... first of all I'm not quite sure about the html Luciano posted.
I supposed something like this:

> <div id="box1" class="box">
>      <div class="bloc-top">content top</div>
>      <div class="bloc-center">content slideToggle</div>
> </div>

because the code he posted at the beginning contains the class
selector $('.bloc-center'), but there is no class="bloc-center" in the
sample html.

anyway, filter() will not work in this case, because bloc-center is
not inside bloc-top, but it's next to it.
so I'm using next()

but maybe I went too far.
correct jQuery for an xml like this:

<div id="box2" class="box">
    <bloc-top>content top</bloc-top>
    <bloc-center>content slideToggle</bloc-center>
</div>

would be:

$('bloc-top').click(function(){
   $(this).next().slideToggle('slow');
});



--
att.
Luciano M.
www.m2t.com.br

 « Return to Thread: how i can access classes in my div?

LightInTheBox - Buy quality products at wholesale price