Issue on dojo onlick event on html button
Posted
by
Cuong Le
on Stack Overflow
See other posts from Stack Overflow
or by Cuong Le
Published on 2012-12-11T09:02:05Z
Indexed on
2012/12/11
11:04 UTC
Read the original article
Hit count: 278
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?
© Stack Overflow or respective owner