[jQuery] Re: selecting div's with dynamic id's

2008-07-04 Thread Karl Swedberg
D'oh! silly typo. You crack me up, Michael. :-) --Karl Karl Swedberg www.englishrules.com www.learningjquery.com On Jul 4, 2008, at 3:04 PM, Michael Geary wrote: For anyone who is wondering, "functino" is Italian for "tiny function." Here's another way to write the code,

[jQuery] Re: selecting div's with dynamic id's

2008-07-04 Thread Michael Geary
For anyone who is wondering, "functino" is Italian for "tiny function." Here's another way to write the code, using only a single event handler (event delegation) instead of individual event handlers on every link. This will be faster if there are a lot of product descriptions. I'd also put an ID

[jQuery] Re: selecting div's with dynamic id's

2008-07-04 Thread Diego A.
Hi Karl, Of course, you're right. Javascript should be kept separate from the HTML. Cheers, Diego A. 2008/7/4 Karl Swedberg <[EMAIL PROTECTED]>: > > Hi Kris, > > I'd give the "show description" links a common class -- for example, > "show-description" That way you can use a basic selector to a

[jQuery] Re: selecting div's with dynamic id's

2008-07-04 Thread Karl Swedberg
Hi Kris, I'd give the "show description" links a common class -- for example, "show-description" That way you can use a basic selector to apply to all of those links. Then, I'd use the "this" keyword to find the appropriate description relative to the clicked link. Adding "return fals

[jQuery] Re: selecting div's with dynamic id's

2008-07-04 Thread Diego A.
Hi Kris, The best way is to not use an ID, or to use a class. Based on the HTML you posted, you could just use this: $(this).parent().next().show().end().remove(); ... which will show the description and remove the "show description" link EXAMPLE: Name: Red Widget Price: 22.00 Show d