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 Andrea Varnier :: Rate this Message:

Reply to Author | View in Thread


On 13 Mag, 01:35, Luciano <lmazze...@...> wrote:

> how i can access classes in my div?
> <div id="box1" class="box">
>      <bloc-top>content top</bloc-top>
>      <bloc-center>content slideToggle</bloc-center>
> </div>
>
> <div id="box2" class="box">
>      <bloc-top>content top</bloc-top>
>      <bloc-center>content slideToggle</bloc-center>
> </div>

looking at your code, the action is something like this:
"when the user clicks on a bloc-top element, slide-toggle the next
bloc-center element"
right? this is done in jQuery like this (assuming bloc-top and bloc-
center are classes):

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

:)

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

LightInTheBox - Buy quality products at wholesale price