I ended up doing something very similar to this, and was able toget it
working..

Thank you kindly for your comments they are much appreciated. Its nice
to know there are a lot of resources in the community..

On Sep 22, 2:35 pm, Eric <[EMAIL PROTECTED]> wrote:
> If I understand your question correctly, you should be able to do it
> by Traversing the DOM.
>
> So, let's say that the HTML is like this:
>
> <div class='one_record'>
>   <p>Lorem ipsum...</p>
>   <a class='hide_show_link' href='#'>Hide/Show extra info</a>
>
>   <div class='starts_hidden'>
>      Show this when the link is clicked.
>   </div>
> </div>
>
> So your CSS would probably have something like:
> .starts_hidden { display: none; }
>
> Now, this *wouldn't* work:
> $( function () {
>   $('.hide_show_link').click( function () {
>      $('.starts_hidden').toggle();
>   });
>
> });
>
> Because clicking on a hide_show_link will toggle ALL of the things of
> class 'starts_hidden'.
>
> You probably want to do something like this:
> $( function () {
>    // DOM is ready:
>    $('.hide_show_link').click( function () {
>       // in here, 'this' refers to the particular link we're
> inspecting.
>      $(this).next().toggle();  // start at the current link, find the
> next element in the DOM, and toggle it.
>    });
>
> });
>
> The reason this works is because each link hide shows the Next div in
> the DOM.  If your HTML is different, then the code between $(this)
> and .toggle() will be different.  See:http://docs.jquery.com/Traversing
> for the functions that will help you here.
>
> Cheers,
> -Eric
>
> On Sep 20, 10:40 am, Bob O <[EMAIL PROTECTED]> wrote:
>
> > Hello,
>
> > Im am a CSS guy moving into the world of js and RoR, so its nice to
> > find things like jQuery and supporting groups. I am a n00b, so the
> > more english the response the better....
>
> > Question:
>
> > I have a rails partial that cycles a :collection. So every record in
> > the db table receives the same HTML/CSS structure. There is a hidden
> > div with extra info, that expands when the exposed div is clicked. the
> > problem is ALL of the displayed :collections reveal/hide the extra
> > content at the same time. where the HTML/CSS is dynamically generated,
> > im not sure how to have it differentiate between each item.
>
> > I have seen in the Learning jQuery book that there is a way to loop
> > and add an index, and also some kind of append feature, but Im not
> > quite versed enough to understand if this is what i need.
>
> > any help would be great..
>
> > Thank you

Reply via email to