Why is test.elem undefined in this scenario?
<p>The title gives the error I get when I use the following:</p>

<pre><code>var test = {

    elem : undefined,

    init : function() { console.log("test.init() fired");

        elem = $("#id"); 
        console.log("elem assigned to jQuery object");

        elem.click(function() { console.log("elem clicked"); });
        console.log("elem click handler created");

    }

};

test.init();
test.elem.click();
</code></pre>

<p>I don't understand.  If I run <code>test.init()</code> where it assigns the value for <code>test.elem</code>, why would it be undefined when I try to access it later?</p>
