getElementsByTagName (“div”).length returns zero for any webpage

我怕爱的太早我们不能终老 提交于 2019-12-05 19:36:00
icyrock.com

Not sure what is the difference in the extension context, but it might have to do with namespaces - https://developer.mozilla.org/en-US/docs/Web/API/Element/getElementsByTagName. What is the tag of the first of 1100 elements you get when using "*"?

May be the code is run when the DOM is not ready.

Try to put the JS code inside a script tag at the very end of the body tag.
I'm not sure why * gets so many items though.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!