Skip to content

Latest commit

 

History

History
62 lines (41 loc) · 1.03 KB

replace-node.md

File metadata and controls

62 lines (41 loc) · 1.03 KB

replaceNode

Introduction

Used to replace one DOM node with another.

Syntax

replaceNode(target, node[, replacer])

Parameters

  • target:

    • Type: Node
    • Required: Yes.
    • Usage: Replaced by another node.
  • node:

    • Type: Node
    • Required: Yes.
    • Usage: Replaces another node.
  • replacer:

    • Type: Function
    • Required: No.
    • Usage: Replaces target with node.
    • Reference: replacer.

Return Value

undefined

replacer

Description

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.

Syntax

replacer(target, node)

Parameters

  • target:
    • Type: Node
    • Required: Yes
    • Usage: Gets replaced by another node
  • node:
    • Type: Node
    • Required: Yes
    • Usage: Replaces another node

Return Value

undefined