Unwrap selected element Javascript or Jquery
javascript, jquery
Solution
You can chain contents() into unwrap():
$("#current").contents().unwrap();
`contents()` will return all the children of `#current`, including text nodes, and `unwrap()` can be applied to text nodes.
Problem
This is my html. ``` <span id="current" class="green unselctable" data-original-title="" title=""> Lorem Ipsum is simply dummy </span> ``` I'm selecting with with `$("#current")` but if I use the jQuery unwrap function the parent tag gets removed. Is there any way to remove the span in JavaScript or jQuery without parsing the string and appending it to the dom? Edit I wanna keep the content of the div. I just want the tag removed.