koss
koss

Reputation: 874

Add dynamic handler with dojo

I'm using dojo v1.6 and trying to dynamically add an event handler to the menu onShow event. There's no exceptions thrown yet the alert window is not displayed. What do I do wrong?

dojo.require("dojox.NodeList.delegate");
dojo.query("body").delegate(dojo.byId("dijit_Menu_1"), "onshow", function(){
    alert("Show!!!");
}); 

Upvotes: 0

Views: 68

Answers (1)

Prakash Rajagaopal
Prakash Rajagaopal

Reputation: 602

dijit.byId of the menu with onOpen seems to be working fine for me . Check this fiddle http://jsfiddle.net/prak5190/bEurr/3/

Also make sure that you are taking the id of the right dijit (was making that mistake - was using dijit_Menu_1 instead of dijit_Menu_0 ). Better to either keep a reference of the widget or give it an id .

Upvotes: 1

Related Questions