Forum:Help with jQuery?

Just a simple question I hope can be resolved quickly:

If I had a parent element and a child element, I could execute:

$('.parent').click(function{ $('.child').toggle; });

But if I had multiple parent/child elements, clicking one parent would toggle all children. How could I work around this? Thanks in advance! -Sherm/Talk


 * Example HTML:

 parent child1 child2 child3 child4


 * When you use click or other functions that attach event handlers to an element,  refers to the element in question and is very handy to use inside event handlers.


 * Going up and down the DOM - these functions all allow you to filter by CSS selector too, e.g.


 * children (one level down)
 * find (multiple levels down the tree)
 * parent (one level up)
 * parents (multiple levels up the tree)


 * Matching subsets of the current set of selected elements:
 * first (reduce set to only the first element)
 * last (reduce set to only the last element)
 * filter (reduce set of elements to only those that match a given CSS selector, or those for which a given function returns )
 * slice (reduce set of elements to only those that have indices in a certain range, index (see index) being the position of an element relative to its parent)




 * Okay, thanks, was a big help! Added the jQuery, put in a style, and how I have a nice template to use! -Sherm/Talk