Don't thank us until it works! Let me know how you go, I'd be interested.

IDs should just start with a letter - given that you can only have one
id on any page, it would make sense to name your IDs so they are
useful to you in the future, such as

<div id="company-02" class="company">

You might not need an id at all, unless it's coming from the back-end,
as you can choose the e.g. 4th div.company with jquery.

Dan.

On 3/5/07, JQuery - SimDigital <[EMAIL PROTECTED]> wrote:
>
>  Dan, another question:
>  Why did you typed:
>  "Also, ids shouldn't start with a number."
>  What is the right standard?
>
>  Gustavo Villa.
>
>  Dan Eastwell escreveu:
>  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
> [email protected]
> http://jquery.com/discuss/
>
>
>
>
>
>
> _______________________________________________
> jQuery mailing list
> [email protected]
> http://jquery.com/discuss/
>
>


-- 
Daniel Eastwell

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

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

_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/

Reply via email to