Using the answer from this question:
$(elem)
.contents()
.filter(function() {
return this.nodeType == 3; //Node.TEXT_NODE
}).remove();
Using the answer from this question:
$(elem)
.contents()
.filter(function() {
return this.nodeType == 3; //Node.TEXT_NODE
}).remove();