HTML tutorial
CSS3 tutorial
Bootstrap tutorial
JavaScript tutorial
JQuery tutorial
AngularJS tutorial
React tutorial
NodeJS tutorial
PHP tutorial
Python tutorial
Python3 tutorial
Django tutorial
Linux tutorial
Docker tutorial
Ruby tutorial
Java tutorial
C tutorial
C ++ tutorial
Perl tutorial
JSP tutorial
Lua tutorial
Scala tutorial
Go tutorial
ASP.NET tutorial
C # tutorial
Get the HTML content of the first child element
The firstElementChild
property returns the first child element of the specified
element.
The firstElementChild
property is read-only.
The firstElementChild
property returns the same as children[0].
In the HTML DOM terminology:
Whitespace between elements are also text nodes.
Type | Description |
Node | The first child element of an element.null if no child element exists. |
element.firstElementChild
is a DOM Level 3 (2004) feature.
It is fully supported in all browsers:
Chrome | IE | Edge | Firefox | Safari | Opera |
Yes | 9-11 | Yes | Yes | Yes | Yes |