您好,欢迎访问一九零五行业门户网

jquery提取元素里的纯文本不包含span等里的内容_jquery

复制代码 代码如下:
var text = '';
$('div').contents().each(function(){
if(this.nodetype === 3){
text += this.wholetext;
}
});
nodetype
元素element 1
属性attr 2
文本text 3
注释comments 8
文档document 9
其它类似信息

推荐信息