mirror of
https://github.com/bendtherules/UiQuestions.git
synced 2026-08-18 22:02:42 +00:00
create-modify-element - clarify .append() doc
This commit is contained in:
@@ -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>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user