Issue on dojo onlick event on html button
- by Cuong Le
I am a new kid with dojo, I got weird issue which I take lots of time and have not yet found out, assume I have 4 buttons:
<button id="btnMoveFirst" data-dojo-type="dijit.form.Button" iconclass="plusIcon">
< <</button>
<button id="btnMovePrev" data-dojo-type="dijit.form.Button" iconclass="plusIcon">
<</button>
<button id="btnMoveNext" data-dojo-type="dijit.form.Button" iconclass="plusIcon">
></button>
<button id="btnMoveLast" data-dojo-type="dijit.form.Button" iconclass="plusIcon">
> ></button>
And use dojo with event onclick as below:
dojo.connect(dijit.registry.byId('btnMoveFirst'), "onclick", function(evt){
alert('test1');
});
dojo.connect(dijit.registry.byId('btnMovePrev'), "onclick", function(evt){
alert('test2');
});
dojo.connect(dijit.registry.byId('btnMoveNext'), "onclick", function(evt){
alert('test3');
});
dojo.connect(dijit.registry.byId('btnMoveLast'), "onclick", function(evt){
alert('test4');
});
But when I click any one of 4 buttons, or even any button in form, I got 4 alerts instead of only correct one.
Does anyone know this?