Saturday, July 23, 2011

My Experiments with Dojo

I was trying out a simple example with dojo and was trying to use dojo's event api.
I created a button my button and created a sample function foo.

I did dojo.connect(dojo.byId('mysamplebutton'),'onclick', foo);
to my amazement dojo connected the all the click in the windows to foo and not just for this button. I later discovered that this is a mistake as i should use dojo.ready or dojo.addOnLoad to do this otherwise dojo.byId returns null which makes this event connect to the whole window.

More on this here.
Dojo connects all onclik