How do you make jQuery's .offset() work?
<p>I'm working on a web app that I need to know the coordinates of an element relative to the web page. This seems like it should be simple with jQuery's offset(), however it is not working for me.</p>

<p>Here is the code I am using to find the offset:</p>

<pre><code> var offset=$('#container').offset();
 alert(offset.right);
</code></pre>

<p>Here is the code that I'm using for the  whose position I want:</p>

<pre><code>&lt;div id='container' style='position:absolute; height:30px; width:300px; background-color:orange;'&gt;&lt;/div&gt;
</code></pre>

<p>But when I load the page and the alert() fires, it alerts as undefined. Does anyone have any ideas on how I could fix this?</p>
