jQuery: Finding an element
<p>I'm having trouble with this little thing. I have a code that looks like this:</p>

<pre><code>&lt;table&gt;.........
    &lt;td&gt;
        &lt;span class="editable" id="name"&gt;&lt;?= $name ?&gt;&lt;/span&gt;
        &lt;img class="edit_field" src="icons/edit.png"/&gt;
    &lt;/td&gt;
....... 
&lt;/table&gt;
</code></pre>

<p>I want to obtain the id of the span, so that I can then change it (for example add an input box in it).</p>

<p>I have this:</p>

<pre><code>$('.edit_field').live('click', function() {
    var td = $(this).parent();
    var span = td.find(".editable");
    alert(span.id)
});
</code></pre>

<p>But it's not working... Any ideas? (I'm trying to do it like this so it's reusable)</p>
