I got this code from scriptaculos and it toggles display of the answer
pat then the question part is clicked.

Javascript
========
$(document).ready(function () {
   $
('div.faqitem').find('div.answer').hide().end().find('div.question').click(function()
{
     $(this).next().slideToggle(); });
   });

HTML Code
=========
<div class="faqitem">

 <div class="question">
   Topic
 </div>

 <div class="answer">
   expansion
 </div>

</div>

I am trying to extend the CSS to:

1. give the question part a different colour if the answer is empty

2. avoid expanding the answer section if it is empty.

Any pointers in how to do that?

I am a Javascript newbie and I'd love an example of how to achieve
this without the library just to know how things work. The source of
the page doesn't include any onclick events. The event appears to be
trapped higher up and passed down to the divs.

There is the working page this code comes from 
http://yogaredux.meripol.net/node/42


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Spinoffs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to