I would like to remove the parent without removing the child - is this possible?
HTML structure:
Pure javascript solution, i'm sure someone can simplify it more but this is an alternative for pure javascript guys.
HTML
Javascript (pure)
function unwrap(i) {
var wrapper = i.parentNode.getElementsByClassName('wrapper')[0];
// return if wrapper already been unwrapped
if (typeof wrapper === 'undefined') return false;
// remmove the wrapper from img
i.parentNode.innerHTML = wrapper.innerHTML + i.outerHTML;
return true;
}
JSFIDDLE