I'm trying to use this code to add an anchor element and set it's onclick event to some Javascript. But no event is being loaded. Looking at the DOM through Firebug tells me that Mootools is indeed added. The element has almost all of the Mootools element functions. But it lacks addEvent.
var delete_ctl = new Element('a',
{
'href' : '#',
'events' :
{
'click' : function() { alert('foo'); }
}
});
delete_ctl.appendText('Remove');
delete_ctl.inject(root);
delete_ctl.addEvent('click', function() { alert('foo'); });
The rendered code in Firebug lacks any indication that the onclick event has been set. When the code is run, Firebug reports a Javascript error: "addEvent is not a function." I feel like I'm missing something basic here.