SO - 20297805

by Arun P Johny

HTML

<div id="description">
    TEXT I WANT REMOVED
    <p>Keep this text</p>
    <p>Keep this too</p>
</div>

JavaScript

$('#description').contents().filter(function(){
    return this.nodeType == 3 && $.trim(this.nodeValue) != '';
}).wrap('<span />').parent().hide()