I would like to know how to point this
to the selected element (event source) inside .on()
method without defining an anonymous event handling function.
For example, in the code bellow, the context for my selected element is document
, i.e. $(this)
is interpreted as document
$('.nav-item').click(MyFrameworkUtils.navigationBinding($(this), 'arg1', 'arg2'))
However, if wrapped in an anonymous event handler, $(this)
is interpreted (desirably) as the selected element.
$('.nav-item').click(function(){
var source = $(this);
MyFrameworkUtils.navigationBinding(source, 'arg1', 'arg2');
});