unwrap() method in jQuery

unwrap() in jQuery

This method is used to remove the parents of the set of matched elements from the DOM.

Syntax

$(selector).unwrap([selector])

  • selector - It denotes a selector to check the parent element. If an element's parent does not match the selector, the element won't be unwrapped.

Example 1

Try Yourself

Example 2 - with element

Try Yourself