How to get the first child of a parent DOM element in JavaScript?
Originally posted here!
To get the first child of a parent element, you can use the firstElementChild property in the DOM element in JavaScript.
Let's say we have a parent element div and three paragragh tags inside it like this,
<div id="container"...
melvingeorge-me.hashnode.dev2 min read