We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
firstChild包含文本节点,firstElementChild不包含
firstChild
firstElementChild
<p id="box">哦 哦 哦<span><span></p> <p id="box1">哦 哦 哦</p> <script> var box = document.querySelector('#box') console.log(box.firstChild); // "哦 哦 哦" console.log(box.firstElementChild); // <span>...</span> var box1 = document.querySelector('#box1') console.log(box1.firstChild); // "哦 哦 哦" console.log(box1.firstElementChild); // null </script>
The text was updated successfully, but these errors were encountered:
No branches or pull requests
firstChild
包含文本节点,firstElementChild
不包含The text was updated successfully, but these errors were encountered: