• Skip to main content
  • Skip to search
  • Skip to select language
    • Technologies Overview
    • HTML
    • CSS
    • JavaScript
    • Graphics
    • HTTP
    • APIs
    • Browser Extensions
    • MathML
    • Learn web development
    • Tutorials
    • References
    • Developer Guides
    • Accessibility
    • Game development
    • ...more docs
    • Send Feedback
    • Contribute to MDN
    • Report a content issue 🌐
    • Report a platform issue 🌐
  1. Web technology for developers
  2. Web APIs
  3. CharacterData
  4. CharacterData.remove()
  • Change language

Table of contents

  • Syntax
  • Example
  • Specifications
  • Browser compatibility
  • See also

CharacterData.remove()

The remove() method of the CharacterData removes the text contained in the node.

Syntax

remove();

Parameters

None.

Example

Using remove()

<span>Result: </span>A long string.
let span = document.getElementsByTagName("span")[0];
let textnode = span.nextSibling;

textnode.remove(); // Removes the text

Specifications

Specification
DOM Standard
# ref-for-dom-childnode-remove①

Browser compatibility

BCD tables only load in the browser

See also

  • Element.remove()
  • CharacterData.deleteData()

Found a problem with this page?

  • Edit on GitHub
  • Source on GitHub
  • Report a problem with this content on GitHub
  • Want to fix the problem yourself? See our Contribution guide.

Last modified: Nov 9, 2021, by MDN contributors

Change your language

Related Topics

  1. Document Object Model
  2. CharacterData
  3. Properties
    1. data
    2. length
    3. nextElementSibling
    4. previousElementSibling
  4. Methods
    1. after()
    2. appendData()
    3. before()
    4. deleteData()
    5. insertData()
    6. remove()
    7. replaceData()
    8. replaceWith()
    9. substringData()
  5. Inheritance:
    1. Node
    2. EventTarget
  6. Related pages for DOM
    1. AbortController
    2. AbortSignal
    3. AbstractRange
    4. Attr
    5. ByteString
    6. CDATASection
    7. Comment
    8. CustomEvent
    9. DOMError
    10. DOMException
    11. DOMImplementation
    12. DOMParser
    13. DOMPoint
    14. DOMPointReadOnly
    15. DOMRect
    16. DOMTimeStamp
    17. DOMTokenList
    18. Document
    19. DocumentFragment
    20. DocumentType
    21. Element
    22. Event
    23. EventTarget
    24. HTMLCollection
    25. MutationObserver
    26. NamedNodeMap
    27. Node
    28. NodeFilter
    29. NodeIterator
    30. NodeList
    31. ProcessingInstruction
    32. Range
    33. StaticRange
    34. Text
    35. TextDecoder
    36. TextEncoder
    37. TimeRanges
    38. TreeWalker
    39. XMLDocument
  • Web Technologies
  • Learn Web Development
  • About MDN
  • Feedback
  • About
  • MDN Web Docs Store
  • Contact Us
  • Firefox

MDN

  • MDN on Twitter
  • MDN on Github

Mozilla

  • Mozilla on Twitter
  • Mozilla on Instagram

© 2005-2022 Mozilla and individual contributors. Content is available under these licenses.

  • Terms
  • Privacy
  • Cookies