<p>I am using jQuery. I call a JavaScript function with next html:</p>

<pre><code>&lt;li&gt;&lt;span&gt;&lt;a href="javascript:uncheckEl('tagVO-$id')"&gt;$tagname&lt;/a&gt;&lt;/span&gt;&lt;/li&gt;
</code></pre>

<p>I would like to remove the <code>li</code> element and I thought this would be easy with the <code>$(this)</code> object. This is my JavaScript function:</p>

<pre><code>function uncheckEl(id) {
    $("#"+id+"").attr("checked","");
    $("#"+id+"").parent("li").css("color","black");                 
    $(this).parent("li").remove();  // This is not working
    retrieveItems();
}
</code></pre>

<p>But <code>$(this)</code> is undefined. Any ideas?</p>

Try something like this (e.g. to hide the
```
<li>
```
):
```
```
function unCheckEl(id, ref) {
  (...)
  $(ref).parent().parent().hide(); // this should be your <li>
}
```
```
And your link:
```
```
<a href="javascript:uncheckEl('tagVO-$id', \$(this))">
```
```
```
$(this)
```
is not present inside your function, because how is it supposed to know where the action is called from? You pass no reference in it, so
```
$(this)
```
could refer to everything but the
```
<a>
```
.