If I have this module pattern:

```
var MODULE = (function(window){
    var myPublicStuff = {};

    myPublicStuff.myPublicMethod = function(e){
        return e;
    };
    return myPublicStuff;

})(window);  //edit:  forgot to put I have this

```

This works: (edited for clarity)

```
v = document.getElementById('some-element'); //works as expected
MODULE.myPublicMethod(v);  //works.

```

But this does not work,

```
MODULE.myPublicMethod().document.getElementById('some-element');

```

or

```
document.getElementById('some-element').MODULE.myPublicMethod().

```

I thought that if the preceding member in the jail returned a value, you could chain it to the next link up? That does not work here, but I do not know why.

Edit: Thanks for all the answers. All I'm trying to do is get the element and have that method print it back out *via chaining*. That's all. if I put in 'btnPrint' I want it to give me `<button type="button" id="btnPrint" class="btn">...</button>` If I do getElementById at the console, that is what I get if I use a variable for my module first (which makes sense.) I only wanted to do the same thing with a chained method.

Edit: For completeness this is What Travis put on JSFiddle (thanks):

```
<button type="button" id="btnPrint" class="btn">...</button>

Element.prototype.myPublicMethod = function(){
 //in the prototype scheme that JavaScript uses,
 //the current instance of the Element is *this*,
 //so returning this will return the current Element
 //that we started with.
 return this;

}

console.log(document.getElementById("btnPrint").myPublicMethod());

```

I agree. This looks bad unless absolutely necessary.