I've just tried this and it seems to work... just wondering what other
unintended side effects I'm not seeing   ;)

$(".extraContent").hide();  // hide the extra stuff by default

$('a.extraContentTrigger').click(function() {     // added a class to
the [TITLE] link
  $(this.parentNode).find('.extraContent').slideToggle();
});



On Jul 16, 12:09 pm, Joe S <[EMAIL PROTECTED]> wrote:
> OK, spoke too soon... on further testing, I'm getting an unintended
> (but really stupid, on my part) side effect...
>
> if i put another anchor in the hidden content (a link to a file or
> site, for example), the toggle is triggered on that click, too (since
> it's in the wrapper DIV, right?). so, in a single table cell, i've
> got:
>
> <div class="contentWrapper">
>    <a href="#">[TITLE of CONTENT]</a>
>       <div class="extraContent">
>          <a href="foo.com">My File</a>
>          <a href="bar.com">Another Site</a>
>       </div>
> </div>
>
> I need to click the title > expose the extraContent > and click the
> links in the extraContent without triggering the toggle. is there way
> to either adjust what i'm listening for (the click of the [Title]) or
> ignore clicks within the extraContent (again, without resorting to
> unique IDs for each row)?
>
> --joe
>
> On Jul 16, 8:59 am, Joe S <[EMAIL PROTECTED]> wrote:
>
> > Hi Karl,
> > Thanks so much for the help - it definitely got me in the right
> > direction. Here's what I ended up with inside the (document).ready
> > function:
>
> > $(".extraContent").hide();  // hide the extra stuff by default
>
> > $('div.contentWrapper').click(function() {     // contentWrapper DIV,
> > contains <a>[TITLE]</a> and .extraContent DIV
> >   $(this).find('.extraContent').slideToggle();  // slide toggles
> > the .extraContent DIV within the .contentWrapper
>
> > });
>
> > it all seems to work; clicking one leaves the others untouched;
> > clicking multiple works as it should. i was getting weird thing
> > happening with the 'td:first-child' approach. is anything i'm doing
> > terribly bad form?
>
> > again, thanks!
>
> > On Jul 15, 7:51 pm, Karl Swedberg <[EMAIL PROTECTED]> wrote:
>
> > > Hi Joe,
>
> > > Assuming that the additional information that you're initially hiding  
> > > is in a span tag, I'd do something like this:
>
> > > $(document).ready(function() {
> > >    $('td:first-child').click(function() {
> > >      $(this).find('span').slideToggle();
> > >    });
>
> > > });
>
> > > --Karl
> > > ____________
> > > Karl Swedbergwww.englishrules.comwww.learningjquery.com
>
> > > On Jul 15, 2008, at 2:04 PM, Joe S wrote:
>
> > > > I know this has got to be in here somewhere; I'm not familiar enough
> > > > with jQuery syntax to know what a valid search string is (i keep
> > > > looking for EACH and THIS and MULTIPLE but I'm not returning anything
> > > > useful). So I apologize that my noob stripes are showing through...
>
> > > > I've got (basically) a table looking like:
>
> > > > Title          |  Release Date  |   Revised Date | Contact
> > > > -----------------------------------------------------------------------------------
> > > > -----------------------------------------------------------------------------------
> > > > Apples       |    08-2005     |    09-2006     | John Smith
> > > > -----------------------------------------------------------------------------------
> > > > Bananas    |    08-2005     |    09-2006     | John Smith
> > > > -----------------------------------------------------------------------------------
> > > > Oranges     |    08-2005     |    09-2006     | John Smith
>
> > > > I'm trying to add the ability to toggleSlide a (initially) hidden div
> > > > under each individual [TITLE] without triggering the rest of the
> > > > hidden content *AND -- if possible* without assigning a unique ID to
> > > > each title/content pair (I could make it work that way, but these
> > > > update a lot, and keeping track of the last unique value is a chore).
>
> > > > For example, clicking on "Apples" would reveal:
>
> > > > Title           |  Release Date  |   Revised Date | Contact
> > > > -----------------------------------------------------------------------------------
> > > > -----------------------------------------------------------------------------------
> > > > Apples        |    08-2005        |    09-2006       | John Smith
> > > > Apples are  |
> > > > Tasty.         |
> > > > -----------------------------------------------------------------------------------
> > > > Bananas     |    08-2005     |    09-2006     | John Smith
> > > > -----------------------------------------------------------------------------------
> > > > Oranges     |    08-2005     |    09-2006     | John Smith
>
> > > > SO... I need some way of saying:
>
> > > > [click a title > reveal the corresponding content > click it again to
> > > > hide it] leaving the rest of the table in tact
>
> > > > Sound doable, or should I just go the unique ID route? Thanks in
> > > > advance!

Reply via email to