#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)
Change History (3)
Changed 9 years ago by
Attachment: | dojoOnTest.html added |
---|
comment:1 Changed 9 years ago by
Component: | Core → Events |
---|---|
Resolution: | → invalid |
Status: | new → closed |
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 9 years ago by
Got it. "click" works like a charm.
BTW, there is a variable called foo for data-dojo-id="foo.bar.testB"
Thanks.
sample file for this issue