I'm not well-versed in jQuery enough yet to code it,
but wouldn't he need some kind of "this" reference to
each commentbox DIV to make the function work independently
for each one?

I use this function to apply a show/hide toggle to various
rows in a table...

                $(document).ready(function() {
        
$('div.calendar').find('div.details').hide().end().find('table.clickme').cli
ck(function() {
                        var answer = $(this).next();
                        if (answer.is(':visible')) {
                        answer.slideUp();
                        } else {
                        answer.slideDown();
                        }
                });
                });

Perhaps some variation of this is what Olaf needs.

Just a quick thought that might (or might not) break the log jam...

Rick



-----Original Message-----
From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of dan
Sent: Saturday, July 21, 2007 10:14 AM
To: jQuery (English)
Subject: [jQuery] Re: Using slideToggle with multiple divs


That all works well and nice, but if I have more than one comment box
on a page it isn't going to work because I would have more than one
commentbox div IDs.

On Jul 21, 8:36 am, Olaf Bosch <[EMAIL PROTECTED]> wrote:
> dan schrieb:
>
> > Hello, I wish to use slidetoggle with multiple divs. I have
> > implemented it using only one div however I want all of the divs to
> > operate independently.
>
> You have trouble with CLASS and ID, try this:
>
> $(document).ready(function() {
> $('#commentbox').hide();
>
> $('a#comment-toggle').click(function() {
>      $('#commentbox').slideToggle("slow");
>      alert($('#commentbox'));
>      return false;
>      });
>
> });
>
>      <div class="story">
>        <div class="storytitle">
>          hello
>        </div>
>        <div class="storybg">
>          blah blah blah
>        </div>
>        <div class="storybottom">
>          <a href="#" id="comment-toggle" name="comment-toggle">comment</a>
>        </div>
>        <div id="commentbox">
>          comment form
>        </div>
>      </div>
>
> Is better to use ID, is faster. You have not more as one comment form
> pro page ;)
>
> --
> Viele Grüße, Olaf
>
> -------------------------------
> [EMAIL PROTECTED]://olaf-bosch.dewww.akitafreund.de
> -------------------------------



Reply via email to