How to get all childNodes in JS including all the 'grandchildren'?

Mike提出了一个问题:How to get all childNodes in JS including all the 'grandchildren'?,或许与您遇到的问题类似。

回答者rvighne给出了该问题的处理方式:

This is the fastest and simplest way, and it works on all browsers:

myDiv.getElementsByTagName("*")

希望本文对你有帮助,欢迎支持JavaScript中文网