I am handling a hyperlink's click event with a javascript function. I am using jQuery's ajax method to delete a record. Then I want to remove the element I just deleted from the page. The page structure looks like this:
<ul>
<li>
<div id="div1"></div>
<div id="div2">
<a id="DeleteItem">This is the hyperlink in question</a>
</div>
</li>
</ul>
What I want to remove is the li element. My assumption is that I would use the following to remove it:
$("a#DeleteItem").parent.parent.remove();
However this throws an exception stating that parent.parent is null or not an object. I also tried just one level up ($"a#DeleteItem").parent.remove();), but then I get an exception stating object does not support this property or method.
What am I doing wrong?