Oh, I forgot - remove the toggleClass call. I used it to change the
formatting of my 'company names' when they were open or closed. You
could write your own function to do that, of course!

On 3/5/07, Dan Eastwell <[EMAIL PROTECTED]> wrote:
> Hi Gustavo,
>
> this would be more semantic:
>
> <div id="1" class="company">
>    <h2 class="name">Some Company</h2>
>    <div class="moreinfo">
>         <p>Something about the company</p>
>    </div>
> </div>
> <div id="2" class="company">
>    <h2 class="name">Other Company</h2>
>    <div class="moreinfo">
>        <p>Something about the other company</p>
>    </div>
> </div>
>
> Also, ids shouldn't start with a number.
>
> I'd use this function, but I'm sure other people could do better - I'm
> more of a CSS person!
>
> function toggleMenuItems(theElement, selectedClassName){
>         $(theElement).click(function() {
>                 theParent = this.parentNode;
>                 toggleClass(this, selectedClassName);
>                 toggleSibling(this);                    // the elements in 
> this container that aren't
> this click handler
>                 return false;
>         });
> }
>
> function toggleSibling(theElement){
>         var theSiblings = $(theElement).siblings().not(theElement);
>         $(theSiblings).toggle("slow");
> }
>
> and this in your document.ready function:
>
> toggleMenuItems("div.company h2", "closed");
>
> with .closed { } being any CSS you might want to add.
>
> Thanks,
>
> Dan.
>
> On 3/5/07, JQuery - SimDigital <[EMAIL PROTECTED]> wrote:
> > How could I get the ID from a parent div of my element?
> > I think that will be the shortest path to do what i need, as described
> > bellow:
> >
> > Example:
> > <div id="1" class="company">
> >     <div class="name">Some Company</div>
> >     <div class="moreinfo">Something about the company</div>
> > </div>
> > <div id="2" class="company">
> >     <div class="name">Other Company</div>
> >     <div class="moreinfo">Something about the other company</div>
> > </div>
> >
> >
> > I'm trying to do a company list of my city.
> > The ".moreinfo" will be showed when clicked into "Some Company" or
> > "Other Company", obviously showing just more info of the clicked company.
> >
> > Thanks a lot!
> > Villa, Gustavo.
> >
> >
> > _______________________________________________
> > jQuery mailing list
> > discuss@jquery.com
> > http://jquery.com/discuss/
> >
>
>
> --
> Daniel Eastwell
>
> Portfolio and articles:
> http://www.thoughtballoon.co.uk
>
> Blog:
> http://www.thoughtballoon.co.uk/blog
>


-- 
Daniel Eastwell

Portfolio and articles:
http://www.thoughtballoon.co.uk

Blog:
http://www.thoughtballoon.co.uk/blog

_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/

Reply via email to