dojo/on vs widget.on
An example of connecting to widget or dom events...
HTML
<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/dojo/1.9.0/dijit/themes/claro/claro.css">
<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/dojo/1.9.0/dojox/grid/resources/Grid.css">
<div class="textinputSection jsInputWrapper">
<input type="password" value="" name="pass1" id="pass1" class="smallestInput" maxlength="2" title="${staticTemplateData.pass1}">
<input type="password" value="" name="pass2" id="pass2" class="smallestInput" maxlength="2" title="${staticTemplateData.pass2}">
<input type="password" value="" name="pass3" id="pass3" class="smallestInput" maxlength="2" title="${staticTemplateData.pass3}">
<input type="password" value="" name="pass4" id="pass4" class="smallestInput" maxlength="2" title="${staticTemplateData.pass4}">
</div>
JavaScript
require([
"dojo/query",
"dojo/on",
"dojo/dom",
"dijit/focus",
"dojo/domReady!"
], function(query, on, dom, focusUtil){
var $inputs = query('.jsInputWrapper input[type="password"]');
$inputs.forEach(function($input, index){
on($input, 'keyup', function(e) {
var $this = query(e.currentTarget);
var key = (e.keyCode ? e.keyCode : e.which);
console.log($this[0].value);
if ((key >= 48 && key <= 105 && $this[0].value.length >= 2) || key == 229){
//alert(e.keyCode);
focusUtil.focus(dom.byId("pass"+(index+2)));
}
});
});
});