I have a small piece of jQuery like this:
$('.remove-header').on('click',function(){
arc.event_handler.remove_header_click.call(this);
});
The .remove-header is nested within a similar object so I need to call event.stopPropogation but normally I’d pass a reference like this:
$('.remove-header').on('click',function(event){
arc.event_handler.remove_header_click(event);
});
How would I combine both of these into a call? The couple things I have tried haven’t seemed to work.
thx
Passing the
eventobject can simply be done by passing it as additional argument to.call:Have a look at the documentation for
.call.But you can also directly stop the propagation inside the event handler like jfriend00 showed.