Q: Pass element into function WITHOUT anonymous function in jquery As the title, is there a way to pass an element into a function without using an anonymous function?
Or in other words:
I know I can pass element into function as follows:
function fakeFunction(elementReceived){
    elementReceived.hide();
}
$(".class-x").each(function(){
    fakeFunction($(this));
});

which is not acceptable as I am required to prevent using anonymous function due to some problem in testing.
So I write something like this:
function fakeFunction(){
    $(this).hide();
}
$(".class-x").each(fakeFunction);

This is better but the readability is decreased, as the function in the actual code is very far away from the calling line and using $(this) directly is confusing.
I was told (and was requested to investigate) that something like the following should be possible:
function fakeFunction(elementReceived){
    elementReceived.hide();
}
$(".class-x").each(fakeFunction, $(this));

but the $(this) in the above code passed the whole document instead..... What should be the proper way to write it?

A: If you look at the documentation for each, you'll see that the second argument to the function is the element (e.g., the same as this). So:
function fakeFunction(index, element){
    $(element).hide();
}
$(".class-x").each(fakeFunction);

(Of course, in this particular case, you could just do $(".class-x").hide();, but I assume fakeFunction actually does something else.)
