[jQuery] Selecting a specific number of children rather than number of specific elements

[jQuery] Selecting a specific number of children rather than number of specific elements


Hi All,
I was wondering if someone could help refine a content toggling
solution that I have now. As of now, the demo page below takes the
first 3

elements within a parent <div> with a specific ID and
hides the remainder of the paragraphs in this parent <div> by placing
them in a newly created <div> and then creating an <a> element that
toggles the visibility of this new <div> container.
http://brian-talbot.com/inventingroom/jquery-expand/
I'd like to be able to include other elements besides

within the
original parent <div> and have JQuery count and display the first
three child elements (regardless of what they are) of the parent <div>
and hide the remainder as it does now. Does anyone have any advice on
how to think about or execute this?
Please note: the demo above contains other elements aside from


elements to demonstrate the current limitations of what I have now.
Thanks for your help as always.