I need to call the .each() function on multiple jQuery objects like this:

```
$('#table_1').each(function(){ /* foo */ });
$('#table_2').each(function(){ /* foo */ });
$('#table_3').each(function(){ /* foo */ });

```

I have not found a better way of doing this than writing out each function individually. 

Defining a function like this:

```
$.fn.extend({
    foo: function() {

        //Some code
    }
});

$('#table_1').each(foo);

```

returns a "cannot read property 'call' on undefined function" error in the console. 

What am I doing wrong here?