Login Register

Event handlers via markup: shorthand way to get onClick="dijit.byId('${id}')....

When I use a templatePath to an HTML document that instantiates widgets in the markup, I find myself constantly using event handlers to call methods within that widget. If I was doing this programatically I would just refer to the method as this.methodName(). But when the event is fired, "this" refers to the scope of the HTML element (tag) not the widget.

I've been doing this:

Is there a cleaner/easier way to refer to the widget from markup, other than dojo.byId('${id}')?

Oops that should have been dijit.byId

I made a mistake in the code above: all references to "dojo.byId" should have been "dijit.byId" instead. My bad.