0

I have one string "str" that contains large DOM tree in the string format. I am able to convert it to DOM object.

But I want to remove a div element from the object say classname "something" but should not delete the inner content.

Lets say suppose, inside an HTML dom, there is a div and its classname is "something. And this div contains many elements say p, div, span etc. I want to have it as it is, whatever it contains and only want to remove the div tag from the object which is wrapped all these elements and then again convert back to the string.

Toseef Khilji
  • 17,192
  • 12
  • 80
  • 121
Rohit Singhal
  • 429
  • 1
  • 3
  • 17
  • 1
    If you've figured out how to get the string as actual nodes, then all you have to do is write your own unwrap() method, look at how jQuery does it to get some pointers, or just use jQuery – adeneo Dec 27 '13 at 11:04
  • One way would be to use JQuery's unwrap() See here: [jquery-remove-a-tag-but-keep-innerhtml][1] [1]: http://stackoverflow.com/questions/4232961/jquery-remove-a-tag-but-keep-innerhtml – Eran Boudjnah Dec 27 '13 at 11:05

0 Answers0