Used to replace one DOM node with another.
replaceNode(target, node[, replacer])
-
target
:- Type:
Node
- Required: Yes.
- Usage: Replaced by another node.
- Type:
-
node
:- Type:
Node
- Required: Yes.
- Usage: Replaces another node.
- Type:
-
replacer
:- Type:
Function
- Required: No.
- Usage: Replaces
target
withnode
. - Reference:
replacer
.
- Type:
undefined
Used to replace a DOM node with another. Using replacer, you can decide how a node replaces its target. You can apply animations such as slide, fade and the like if you like. If not provided, replaceNode
uses Node.replaceWith
method to replace the node.
replacer(target, node)
target
:- Type:
Node
- Required: Yes
- Usage: Gets replaced by another node
- Type:
node
:- Type:
Node
- Required: Yes
- Usage: Replaces another node
- Type:
undefined