while clicking on the button on.click event is not fired and getting error "Cannot read property 'on' of undefined",how to solve this issue.

Simple Map html, body, #map { height: 100%; width: 100%; margin: 0; padding: 0; } body { background-color: #FFF; overflow: hidden; font-family: "Trebuchet MS"; } var map,navToolbar;

           "dojo/domReady!"], function(Map,dom,on,parser,registry) {
      map = new Map("map", {
      basemap: "streets",  
      center: [72, 25.75], 
      zoom: 5
    //navToolbar = new Navigation(map);
      //on(navToolbar, "onExtentHistoryChange", extentHistoryChangeHandler);

    function showMessage(){


Click Me

  • Could be a couple of things. Can you show what the html for the button element looks like? It should of course have id="clickMe" as one of its attributes and will need to be of data-dojo-type="dijit/form/Button" Dec 4, 2015 at 13:49

1 Answer 1


you are missing several modules in your require() call, so the mapping of the aliases in your callback are incorrect.

  "dojo/parser", // < this one
  "dijit/registry", // < and this one
  "dojo/domReady!"], function(Map, dom, on, parser, registry, Button) {

afterwards, you need to use your alias when you call on and ensure the corresponding <div> is present.

// ...
<div id="clickMe"></div>

see this old blog of mine for more information.

related threads

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.