createElement
Creates an element from a string (without appending it to the document). If the given string contains multiple elements, only the first one will be returned.
- Use
Document.createElement()to create a new element. - Use
Element.innerHTMLto set its inner HTML to the string supplied as the argument. - Use
ParentNode.firstElementChildto return the element version of the string.