I’m totally new to dojo … and am drawing from my experience with jQuery somewhat …
I have several elements like so:
<input name="info1" value="" style="width:52px" contstraints="{pattern:'#'}" dojoType="dijit.form.NumberTextBox"/>
<input name="info2" value="" style="width:52px" contstraints="{pattern:'#'}" dojoType="dijit.form.NumberTextBox"/>
<input name="info3" value="" style="width:52px" contstraints="{pattern:'#'}" dojoType="dijit.form.NumberTextBox"/>
But I’m having the hardest time tring to assign a simple onKeyUp event … everything ive tried looks like it would work but doesn’t … console always reports that the thing im trying to do is not a function …
dojo.addOnLoad(function()
{
dojo.query('input[name^=info]').connect('onkeyup',function(e)
{
console.log('oh yeah');
});
});
What am i doing wrong, what should I be looking out for ???
Unfortunately,
dojo.query()will only return native DOM nodes. I think you want to get back the rendered Dijit Widget.To do that, you’ll need to assign your inputs IDs and use
dijit.byId().Also, unlike native HTML event names, Dojo event names are case-sensitive. So,
onkeyuprefers to the native HTML and is different from the Dojo event nameonKeyUp.I think you may also have an extra ‘t’ in
contstraints.An example usage: