代码如下:
var text = '';
$('div').contents().each(function(){
if(this.nodeType === 3){
text += this.wholeText;
}
});
| 元素element | 1 |
| 属性attr | 2 |
| 文本text | 3 |
| 注释comments | 8 |
| 文档document | 9 |
SyntaxHighlighter.highlight();
代码如下:
var text = '';
$('div').contents().each(function(){
if(this.nodeType === 3){
text += this.wholeText;
}
});
| 元素element | 1 |
| 属性attr | 2 |
| 文本text | 3 |
| 注释comments | 8 |
| 文档document | 9 |
SyntaxHighlighter.highlight();