Monday, February 10, 2014

Using dojo/on to react to a change in a dropdown list in dojo.

A coworker suggested that a better, modern (dojo 1.9.2) way to do this is:

define([
   "dojo/dom",
   "dojo/on"
], function (dom, on) {
   return {
      init: function(current, data) {
         var self = this;
         dojo.addOnLoad( function() {
            on(dom.byId('locale'), "change", function(evt) {
               alert(self.locale.value);
               dojo.stopEvent(evt);
            });
         });
      },

No comments:

Post a Comment