获取标签中除子标签以外的文本元素

var text = $("h3").contents().filter(function() { return this.nodeType === 3; }).text(); 

原文地址:https://www.cnblogs.com/qhhw/p/6772558.html