I need to find what the first child of an element is.
For example:
<div class="parent">
<div class="child"></div>
<img class="child" />
<div class="child"></div>
</div>
In this example the FIRST child is a div.
Another example:
<div class="parent">
<img class="child" />
<img class="child" />
<div class="child"></div>
</div>
In this example the first child is a img.
Yet another one:
Or if you already have any other reference to the parent element, you can simply access its
childrenproperty (assuming it is a DOM node, not a jQuery object):Reference:
.children(),.get(),Element.children,Node.nodeName