Update createElement.md

This commit is contained in:
Angelos Chalaris
2018-01-06 13:15:31 +02:00
committed by GitHub
parent e4349ee086
commit 0fe7a2dce8

View File

@ -1,10 +1,11 @@
### createElement ### createElement
Creates an element from a string. 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. Set its `innerHTML` Use `document.createElement()` to create a new element.
to the string supplied as the argument. Use `ParentNode.firstElementChild` to Set its `innerHTML` to the string supplied as the argument.
return the element version of the string. Use `ParentNode.firstElementChild` to return the element version of the string.
```js ```js
const createElement = str => { const createElement = str => {