views:

61

answers:

2

Hi all, I wonder how to replace the bindWithEvent funtion in Mootools 1.3, the example in the documentation is very basic:

Element.addEvent('click', function(e){
myFunction.bind(bind, [e]);});

But, what about if I need to pass a param to the event handler? This is the way in Mootools 1.2:

Element.addEvent('click', function(e, param) { e.stop(); alert(param) }.bindWithEvent(this,['text']);

Any idea on how to replace this in Mootools 1.3.

Update: I found a very ugly solution, but a least it works while I find a built-in solution:

Element.addEvent('click', function(e){ e.stop(); this.bind.myFunc(this.param);}.bind({bind:this, param: 'text'}));
+1  A: 

You should read the upgrade from 1.2 to 1.3 page: http://github.com/mootools/mootools-core/wiki/Update-from-1.2-to-1.3

This is what I came up with: http://jsfiddle.net/MBx2D/2/

Savageman
I did it before and it didn't help me
Alfredo Artiles Larralde
See my edited answer.
Savageman