create-modify-element - clarify .append() doc

This commit is contained in:
2020-10-16 02:16:12 +05:30
parent fc66060c59
commit 8d2f4ecba7
+3 -3
View File
@@ -134,15 +134,15 @@ eleDiv.appendChild(eleH1)
</Admonition> </Admonition>
<Admonition type="note" title="`.append()`"> <Admonition type="note" title="`.append()`">
There is a newer api called `.append()`, which is similar. There is a newer api called .append(), which is similar.
⭐️ `.append()` allows multiple child elements or string as argument. It creates Text node automatically if the input is a string. ⭐️ .append() allows you to insert multiple child elements in a single call. It also allows string as input, which gets converted to Text node.
```js ```js
ele1.append(ele2, ele3, 'hello world') ele1.append(ele2, ele3, 'hello world')
``` ```
💔 `.appendChild()` only allows a single element as input. 💔 .appendChild() only allows inseting a single element at a time.
</Admonition> </Admonition>
</Accordion> </Accordion>