0

Let's say I have:

<a href=''>
    <div>hello</div>
</a>

I want to remove the A element so to obtain:

<div>hello</div>

Can this be done in jQuery?

drake035
  • 3,955
  • 41
  • 119
  • 229

3 Answers3

5

Use unwrap()

$('div').unwrap();

Live DEMO

Tushar Gupta - curioustushar
  • 58,085
  • 24
  • 103
  • 107
2

use the unwrap() of jquery http://api.jquery.com/unwrap/

$('div').unwrap();
1

The .unwrap() method removes the element's parent.

$('div').unwrap();
Irvin Dominin
  • 30,819
  • 9
  • 77
  • 111
Maz I
  • 3,664
  • 2
  • 23
  • 38