[jQuery] Identifying the type of parent

[jQuery] Identifying the type of parent

<html>
<body>
Hello folks,
I have a function, triggered when a particular type of link is clicked,
which collects and inserts some text after the parent of the clicked
link.
This function works fine when the parent is a p tag, but I'm having
trouble when the link is within a list tag.  In this instance I
would want the new text to be presented after the closing list item
tag.
How do can I distinguish whether the clicked link is within a p tag or
within an li tag?
Thanks,
Bruce
<tt>function fnGetSnippet(ni){
   
$.get("../scripts/ajax_fsheets.asp?id=getDD&ddID=" + ni +
"&q=" + new Date().getTime(), function(responseText){
<x-tab>        </x-tab>
$('#'+ni).parent().after(responseText);
<x-tab>        </x-tab>
$('#'+ni).unbind('click.drill').addClass('showme');
<x-tab>        </x-tab>var $match
= $('#hide'+ni);
<x-tab>        </x-tab>
$('#'+ni+'.showme').toggle(function() {
<x-tab>        </x-tab><x-tab>
        </x-tab>
$match.fadeOut('slow');
<x-tab>        </x-tab><x-tab>
        </x-tab>}, function ()
{
<x-tab>        </x-tab><x-tab>
        </x-tab>
$match.fadeIn('slow');
<x-tab>        </x-tab><x-tab>
        </x-tab>}
<x-tab>        </x-tab>);
});
}</body>
</html>