Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

Element.lastElementChild

概 述

lastElementChild 返回当前元素的最后一个子元素节点,如果没有子元素节点,则返回null.该属性是只读的.

语法

var childNode = elementNodeReference.lastElementChild; 

例子

<p id="para-01">
  <span>First span</span>
  <b>bold</b>
</p>

<script type="text/javascript">
  var p01 = document.getElementById('para-01');
  alert(p01.lastElementChild.nodeName)
</script>

弹出框显示 "B".

相关链接

规范

lastElementChild was introduced in the W3C Element Traversal Specification.

文档标签和贡献者

 此页面的贡献者: teoli, khalid32, ziyunfei
 最后编辑者: khalid32,