Jquery return element html instead of content

Posted by jim smith on Stack Overflow See other posts from Stack Overflow or by jim smith
Published on 2010-12-23T08:45:54Z Indexed on 2010/12/23 8:53 UTC
Read the original article Hit count: 220

Filed under:

I have something like this

<ul>
<li class="aclass" id="a">content</li>
<li class="aclass" id="b">content</li>
<li class="aclass" id="c">content</li>
<li class="aclass" id="d">content</li>
<li class="aclass" id="e">content</li>
<li class="aclass" id="f">content</li>
</ul>

I have code like

$(".aclass").live("mousedown",function() {

alert($this.html());

});

This will alert the content, what I would like to do is alert the entire element like

<li class="aclass" id="f">content</li>

I've tried $(this).parent() but that returns the whole UL

© Stack Overflow or respective owner

Related posts about jQuery