If I have this:
$(SomeID).on({
click: function () { SomeFunction1(); },
mouseenter: function () { SomeFunction2(); },
mouseleave:function () { SomeFunction3(); }
}, '.SomeClass');
I can rewrite it as
$(SomeID).on({
click: SomeFunction1,
mouseenter: SomeFunction2,
mouseleave: SomeFunction3
}, '.SomeClass');
But what if I need to pass some parameter like this:
$(SomeID).on({
click: function () { SomeFunction1($(this)); },
mouseenter: function () { SomeFunction2($(this).index()); },
mouseleave: function () { SomeFunction3($(this).index()); }
}, '.SomeClass');
Is there an alternative?
Thanks.
this, it will be available to those those functions.