parent() method refers to top-level elements in given HTML objects, usually selected by jQuery selector. Parent method is used to manipulate changes to be done at the top level of a nested HTML object.

Example: A paragraph which contains a couple of list elements can be a parent. Usually, Parent is used if there is an action based on the child element or if there is any specific need for a parent to be treated differently.

BY Best Interview Question ON 29 Jun 2019


    $("span").parent().css({"display": "block", "border": "1px solid red"});