Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#14536 closed defect (invalid)

dojo.on doesn't work with dijit.form.Button

Reported by: helloworld Owned by:
Priority: high Milestone: tbd
Component: Events Version: 1.7.0
Keywords: dojo.on dijit Button Cc:
Blocked By: Blocking:

Description

hi,

with v1.7.0, dojo/on doesn't work for dijit.form.Button, and dojo.connect is OK. Please see the attached sample file.

As the doc said below: The target object may be a host object with it's own event capabilities (like DOM elements or the window), or it may be an event emitting JavaScript? object (an object with an on() method like Dijits).

Attachments (1)

dojoOnTest.html (1.1 KB) - added by helloworld 8 years ago.
sample file for this issue

Download all attachments as: .zip

Change History (3)

Changed 8 years ago by helloworld

Attachment: dojoOnTest.html added

sample file for this issue

comment:1 Changed 8 years ago by bill

Component: CoreEvents
Resolution: invalid
Status: newclosed

Your test case doesn't work because there is no variable called foo.

But beyond that, you are using on() incorrectly. Remove the "on" prefix from the event name. This is correct:

on(foo.bar.testB, "click", function(){alert("clicked");});

Although, when connecting to widget events, it's more convenient to use the widget's on() method:

foo.bar.testB.on("click", ...);

comment:2 Changed 8 years ago by helloworld

Got it. "click" works like a charm.

BTW, there is a variable called foo for data-dojo-id="foo.bar.testB"

Thanks.

Note: See TracTickets for help on using tickets.