jQuery this() issues
<p><a href="http://jsfiddle.net/watson/Axsjg/" rel="nofollow">Fiddle</a></p>

<p>I must be doing something stupid, but I really can't figure this out, why is this script not console.log(ing) the text from the <code>&lt;p&gt;</code> tag?</p>

<p>HTML:</p>

<pre><code>&lt;div&gt;
    &lt;label&gt;Display Name:&lt;/label&gt;
    &lt;div&gt;
        &lt;p&gt;The room that its in.&lt;/p&gt;
        &lt;span class="edit"&gt;&lt;/span&gt;
    &lt;/div&gt;
&lt;/div&gt;
</code></pre>

<p>jQuery:</p>

<pre><code>if ($('span.edit').length &gt; 0) {
    $(this).click(function(){
        var elem = $(this).prev();
        var text = elem.text();
        console.log(text);
        elem.html('&lt;input type="text"&gt;' + text + '&lt;/input&gt;');
    });
}
</code></pre>
