Thank you for that. This suits my requirements. However, is there a way to do .. sort of... subqueries??? First a selector, than another selection filter over the result.
Example: var AllSideBoxes = $(".SideBox"); //gets all sideboxes var SomeItems = $(AllSideBoxes).SubQuery(".SideItem"); //gets all SideItems from the result of the previous query Thanks Aaron On Dec 8, 5:02 pm, MorningZ <morni...@gmail.com> wrote: > Here's a simple example based on your class names > > http://jsbin.com/ayate/edit > > On Dec 8, 9:40 am, Aaron Gusman <ict.aarongus...@gmail.com> wrote: > > > > > I'd like to create my own type of accordian however I am finding > > difficulty with creating the query for selection. > > > Say I have a div with another two divs inside - I will call this > > parent div as the SideBox. > > > The first child div is the header and it is the one that will be > > clicked - I will call this div the SideBoxHeader as even the CSS class > > will have this name . > > The second div will contain other things and it is the one that will > > hide when the the Header is clicked - I will call this div the > > SideBoxContent . > > > I am trying to create jquery syntax to associate code to the header > > div so that it hides the Content div when clicked the first time and > > shows it back when clicked a second time. Note that we will have more > > than one SideBox on the same page. > > > $(".SideBox .SideBoxHeader").toggle(function () { ######## }, function > > () {######### }); > > > How will I find the .SideBoxContent sibling of the SideBoxHeader that > > was clicked?? > > > I do not know how to write a selector that works on another > > selection. In one of the toggle functions how can I find the sibling > > of the SideBoxHeader I clicked??? $(this)(???)