Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6327421
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T17:16:37+00:00 2026-05-24T17:16:37+00:00

Short-form question I’m executing dojo.query() and applying an event handler to all of the

  • 0

Short-form question

I’m executing dojo.query() and applying an event handler to all of the returned nodes, using the NodeList.onmouseenter() function. However, when one of those nodes triggers the event, I need to know which one it was, so I can traverse the DOM from that particular node’s location. How can I get a reference that particular node at trigger-time?

Long-form question with full context

I am trying to adapt a jQuery-powered navigation menu (see overview and complete source) to work in a Dojo environment. In a nutshell, the HTML looks like this:

<ul class="topnav">
    <li><a href="#">Home</a></li>
    <li>
        <a href="#">Tutorials</a>
        <ul class="subnav">   <!-- This CSS class hides the <ul> on page load -->
            <li><a href="#">Sub Nav Link</a></li>
            <li><a href="#">Sub Nav Link</a></li>
        </ul>
        <span></span>         <!-- CSS fills the <span> with an image -->
    </li>
    ...

The outermost <ul> tag represents the navigation menu as a whole… and the nested <ul> tags are where a menu item has a drop-down submenu. Such menu items also have an <span> tag in there, to display an arrow image and make things easier to identify during DOM-traversing.

So, the jQuery code adds an event handler to all those <span> tags. The tutorial link above uses an “onClick“, but I plan to change that to a hover (i.e. “onmouseenter” and “onmouseleave“). Either way, the event trigger causes the hidden submenu to be diplayed with a jQuery “slideDown” effect (equivalent to Dojo’s “wipeIn“).

$("ul.topnav li span").click(function() { 
    $(this).parent().find("ul.subnav").slideDown('fast').show();
});

To get from the <span> to the nested <ul>, the event handler crawls the DOM one level up and then one level back down… starting from $(this). This is the part that is killing me in Dojo! I’ve tried dozens of variations, but here is my current (broken) code:

dojo.require("dojo.fx");
dojo.require("dojo.NodeList-traverse");
dojo.require("dojo.NodeList-manipulate");
dojo.ready(function(){

    dojo.query("ul.topnav li span").onmouseenter(function(node) {
        node.siblings("ul.subnav").wipeIn().play();
    });

}

Inside of Dojo’s NodeList event connection functions (e.g. onmouseenter), I can’t figure out how to get a trigger-time reference to the node that was triggered. The anonymous function I’m passing to “onmouseenter” takes a parameter called “node“, but that’s just my wishful thinking. Dojo doesn’t really pass such a reference.

What I need is an equivalent to the $(this) on the second line of the above jQuery snippet. A reference to the particular node that was event-triggered, so that I can traverse the DOM from that particular node’s location. Is there an easy way to do this with Dojo’s NodeList that I’m just missing?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T17:16:38+00:00Added an answer on May 24, 2026 at 5:16 pm

    IIRC, the onmouseenter callback doesn’t receive a node as a parameter but receives an event object instead. If this is the case you can try to:

    1. Get the node through other means, (evt.currTarget or something like that, I always get confused with these…)

    2. Use a forEach instead, get the references to the nodes, and do the event connection manually:

       dojo.query('blabla').forEach(function(node){
           dojo.connect(node, 'onmouseenter', function(evt){
               //node should point to wat you want now
               node.siblings("ul.subnav").wipeIn().play();
           });
       });
      
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The short form of this question: When, if ever, is it appropriate to use
Is the second query a short form of the first? Is the second one
Short version: I want to trigger the Form_Load() event without making the form visible.
I didn’t found short form for this question as subject… Is it possible to
SHORT FORM(!) In response the Jon Skeet's comment, what I want C# to be
All, This question probably has a very simple answer - something I'm overlooking. But
The short question is: I have a webpage in coldfusion / asp.net with many
(Apologies in advance if this question is short on details, I'll watch the comments
This is SQL Server question but I would appreciate the answers form other DBMS
I have a noob question but he, i'm learning :-) I'm making a form

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.