Javascript/jQuery object coding issue
<p>So I have a newly created Javascript object called EditableObject in my custom .js file</p>

<pre><code>function EditableObject(e, dv, i) {
this.element = e;
this.default_value = dv;
this.set = 0;
this.id = i;

alert(this.element.html());

this.element.click(function (event) {
    alert(this.element.html());
});
</code></pre>

<p>}</p>

<p>In my main page, I have a div called "field" that has the text "yeah" in it like such:</p>

<pre><code> &lt;div id="field"&gt;yeah&lt;/div&gt;
</code></pre>

<p>In the script portion of my main page, I've got:</p>

<pre><code>var t = new EditableObject($("#field"), "value", 1);
</code></pre>

<p>When the page loads, there is an alert box that says "yeah". But when I click on the div, I get an error saying that "this.element is undefined". Why is this happening?</p>
