mirror of
https://github.com/bendtherules/UiQuestions.git
synced 2026-08-18 13:52:50 +00:00
create-modify-element - Add insertAfter() note
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
---
|
||||
id: create-modify-element
|
||||
# title: Create / modify DOM nodes
|
||||
# sidebar_label: DOM Manipulation
|
||||
title: DOM Manipulation
|
||||
slug: /
|
||||
@@ -190,3 +189,13 @@ var newEle = document.createElement("li")
|
||||
|
||||
parent.insertBefore(newEle, ref)
|
||||
```
|
||||
|
||||
:::note insertAfter()
|
||||
There is no `insertAfter()` method. It can be emulated by combining insertBefore method with ele.nextSibling.
|
||||
|
||||
```js
|
||||
parent.insertBefore(newEle, ref.nextSibling)
|
||||
```
|
||||
:::
|
||||
|
||||
<MDN title="removeChild" url="https://developer.mozilla.org/en-US/docs/Web/API/Node/removeChild" />
|
||||
Reference in New Issue
Block a user