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

  • Home
  • SEARCH
  • 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 9005341
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T01:07:08+00:00 2026-06-16T01:07:08+00:00

I am a new kid with dojo, I got weird issue which I take

  • 0

I am a new kid with dojo, I got weird issue which I take lots of time and have not yet found out, assume I have 4 buttons:

<button id="btnMoveFirst" data-dojo-type="dijit.form.Button" iconclass="plusIcon">
    &lt; &lt;</button>
<button id="btnMovePrev" data-dojo-type="dijit.form.Button" iconclass="plusIcon">
    &lt;</button>
<button id="btnMoveNext" data-dojo-type="dijit.form.Button" iconclass="plusIcon">
    &gt;</button>
<button id="btnMoveLast" data-dojo-type="dijit.form.Button" iconclass="plusIcon">
    &gt; &gt;</button>

And use dojo with event onclick as below:

dojo.connect(dijit.registry.byId('btnMoveFirst'), "onclick",  function(evt){
    alert('test1');
});

dojo.connect(dijit.registry.byId('btnMovePrev'), "onclick",  function(evt){
     alert('test2');
});

dojo.connect(dijit.registry.byId('btnMoveNext'), "onclick",  function(evt){
     alert('test3');
});

dojo.connect(dijit.registry.byId('btnMoveLast'), "onclick",  function(evt){
     alert('test4');
});

But when I click any one of 4 buttons, or even any button in form, I got 4 alerts instead of only correct one.

Does anyone know this?

  • 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-06-16T01:07:09+00:00Added an answer on June 16, 2026 at 1:07 am

    The reason for I got 4 alerts instead of only correct one is the combination of:

    • buttons are not instantiated in the moment of invoking dojo.connect → wrap your code into dojo/ready
    • connecting to method which does not exist → connect to onClick instead of onclick

    Based on the discussion, here is the way how to write the code in the question in Modern Dojo:

    require([
        "dojo/ready",
        "dojo/aspect",
        "dijit/registry",
        "dijit/form/Button"
    ], function(
        ready,
        aspect,
        registry
    ) {
    
        ready(function() {
    
            // dojo/Evented
            registry.byId("btnMoveFirst").on("click", function() {
                console.log("first");        
            });
    
            // dojo/aspect 
            // it's the same as dojo.connect in previous versions
            // nevertheless this is not recommended
            aspect.after(registry.byId("btnMoveLast"), "onClick", function() {
                console.log("last");            
            });       
    
        });
    
    });
    

    The working example: http://jsfiddle.net/phusick/355MT/
    ​

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Objective-C v2.0 (which is what the mac uses) got a new feature, Garbage Collection.
Im the new kid on the block so I apologyze if I'm not doing
New to PHP and MySQL, have heard amazing things about this website from Leo
so I have this code: $sql = new Zend_Db_Select($db); $sql->from(j); $sql->join(k,k.id = j.id,array()); echo
New to Windows Azure was not sure if its a good idea to use
(New to Objective-C, but well versed in C/C++). Presently I have an Objective-C class
I recently switched from notepad++ to the new kid in the block Notepad2 .
I have a kid's app for Android and there are some unique considerations for
I have got a native join sub query problem in MySQL Entity. SQL code
New to programming and need a little assistance. I have a WPF usercontrol used

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.