且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

jQuery获取页面中所有元素的文本

更新时间:2023-02-18 09:41:12

简单得多:$('body').text()为您提供页面上的整个文本.

It's much more simple: $('body').text() gives you the whole text on the page.

如果您需要遍历所有文本节点,请参见此处:如何使用jQuery选择文本节点?

If you need to iterate over all the text nodes, see here: How do I select text nodes with jQuery?