Hello,
Being a newby to jQuery, I would appreciate your help with the following.
What I want to create is a webpage with a number of Titles, each followed by a div containing one or more paragraphs, maybe a bulleted list, an image, etc.
Each title must be clickable to expand/collapse the div belonging to it.
When expanding a div, other expanded div's (if any) must collapse.
I found the example on http://viralpatel.net/blogs/create-accordion-menu-jquery/
and tested. It does almost exactly what I want.
HTML example:
I replaced the inner ul's by p's as follows:
Code example:
I adapted the lines 3 and 8: replaced ul by p
So far, so good.
As long as each of my Titles is followed by only ONE <p> element, this works excellent. If there are more than one <p>, than only the first <p> is expanded/collapsed.
However, I would like to expand/collapse div's, not p's. Just one <div> per Title.
When I replace the p-tags by div-tags and adapt the code lines 3 and 8 accordingly, the mechanism does not work anymore.
You help will be highly appreciated.
Rgds,
JackNWK