How to find the parent element

Once we have a reference to an HTML element, sometimes we need to know what element contains it. We can get this information from the DOM tree by asking for the element's parent.

var pid = $("#mytarget").parent().attr("id");

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

hello

You are absolutely right !!!

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.