AnsweredAssumed Answered

How to call a button to work from JavaScript API file

Question asked by steven.lzhou on Sep 15, 2014
Latest reply on Sep 16, 2014 by oearley

I am trying to create a group of draw tools like point, freehandpolyline and freehandpolygon in a ESRI's JavaScript map template.  I set up three buttons in the index.html as the following:

 

<button id="point" data-dojo-type="dijit/form/Button"></button>

 

<button id="freehandpolyline" data-dojo-type="dijit/form/Button"></button>

 

<button id="freehandpolygon" data-dojo-type="dijit/form/Button"></button>

 

 

After that I tried to registered these buttons in a file called 'main.js' inside the js folder of the template.

var tb = new Draw(this.map); registry.byId("point").on("click", function () { tb.activate(this.id); }); 

 

But  it just can not call this  button at all.  The debug tools indicate that "cannot read property 'on' of undefined. Any hint would be helpful. Thanks!

Outcomes