Thanks Scott, I did manage to get it working, by switching to toggleClass("makered") instead of using the toggle function.
thanks! On Tue, Jun 24, 2008 at 5:47 PM, Scott Sauyet <[EMAIL PROTECTED]> wrote: > > jaredh123 wrote: > >> <p class="comments-count" id="comments-count-3" >> onclick="javascript:jQuery('#comments-count-3').toggle(function(){jQuery('#comments-count-3').addClass('makered')},function(){jQuery('#comments-count-3').removeClass('makered')}); >> jQuery('#comments-body-3').slideToggle(400)" style="cursor:pointer;">5 >> comments</p> >> >> I know that's hard to read, I have to put the jQuery in the markup, >> because >> the numbers in the ids are generated by PHP in a loop. >> > > I don't know what's causing your problem, but I can suggest alternative > techniques that might make your code simpler. This is entirely untested, > but something like this might work: > > $(document).ready(function() { > $(".comments-count").click(function() { > $(this).toggleClass("makered"); > $(this.id.replace("count", "body")).slideToggle(400); > }); > }); > > or instead of > > $(this.id.replace("count", "body"))... > > you might do something like > > $(this).next(".comment-body")... > > or something else that matches your markup. > > Cheers, > > -- Scott > > -- Jared Henderson NetRivet Websites ProPhoto Blog Theme http://www.netrivet.com http://www.professionalphotographertheme.com