unwrap a html tag itself using jQuery

One day, I came across a problem for unwrapping anchor tag from its contents.

Jquery provides us a unWrap function to unwrap the tag by removing it’s parent tag from the DOM.

Syntax:

Note: it does not take any parameter

Example

But If we want to unwrap anchor text

Its best to learn here BEST NUMBER 1

Its best to learn here BEST NUMBER 1

Its best to learn here BEST NUMBER 1

By Using unwrap function if any child tag exist in unwrapping tag

So there are lot of ways to unwrap a html tag itself using jQuery, overall it depends on your html structure.

You Might Interested In

Leave a Reply

Enclose a code block like: <pre><code>Your Code Snippet</code></pre>.