Skip to content

Instantly share code, notes, and snippets.

@WenLiangTseng
Created July 22, 2013 00:50
Show Gist options
  • Save WenLiangTseng/6050606 to your computer and use it in GitHub Desktop.
Save WenLiangTseng/6050606 to your computer and use it in GitHub Desktop.
jQuery 去除一個元素本身的 HTML Tag
$('b').contents().unwrap();
//For the greatest performance, always go native:
var b = document.getElementsByTagName('b');
while(b.length) {
var parent = b[ 0 ].parentNode;
while( b[ 0 ].firstChild ) {
parent.insertBefore( b[ 0 ].firstChild, b[ 0 ] );
}
parent.removeChild( b[ 0 ] );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment