This is a stripped down example of what I’m trying to do. I’m trying to get my wrapper function myElements to return the elements coming from the underscore each iterator. I can trace out the values of the els inside the _.each function but how can I get my function to return those values when called from my buttonClickListener?
buttonClickListenr: function(event){
if ( $(event.target).is( myElements() )) return;
..// otherwise move on in my event phase
}
myElements: function(){
var filter=['a','b'];
_.each(filter, function(el){
return el
});
}
What you’re trying to do doesn’t really make sense. The ‘include’ operator is probably more useful for you:
if ( _(filter).include($(event.target)) ){ return; }