Loading ...
Sorry, an error occurred while loading the content.

Selector on nested div's

Expand Messages
  • craigdscribner
    A lot of the links in my document are elements instead of elements. I want to return the id of the element that s clicked, but since the div is
    Message 1 of 1 , Feb 3, 2009
    • 0 Attachment
      A lot of the links in my document are <div> elements instead of <a>
      elements. I want to return the id of the element that's clicked, but
      since the div is nested within a bunch of other div's, this code gives
      me about 6 alerts instead of one.

      Is there a way to only return it for the inner-most div?
      2nd Question: is there a way to return the id of the parent div (one
      up from the inner-most)?


      var navFinder = function() {
      alert(this.id);
      }
      var navFinder = YAHOO.util.Selector.query('div');
    Your message has been successfully submitted and would be delivered to recipients shortly.