开发者

Javascript function who return length of html?

开发者 https://www.devze.com 2023-04-12 20:03 出处:网络
Using Javascr开发者_StackOverflow中文版ipt, is there a way that I can determine the size of a document excluding any markup?I think what you want is something like $(document).text().length. It\'s not

Using Javascr开发者_StackOverflow中文版ipt, is there a way that I can determine the size of a document excluding any markup?


I think what you want is something like $(document).text().length. It's not going to be completely exact, but it's going to be a good aproximation.


Here it is:

document.body.innerHTML.replace(/<[^>]*>/g, '').length
0

精彩评论

暂无评论...
验证码 换一张
取 消