Skip to content
Related Articles

Related Articles

Improve Article
Save Article
Like Article

HTML DOM Range deleteContents() Method

  • Last Updated : 08 Jul, 2020

The deleteContents() method deletes all the contents of the Range from the Document tree.



Parameters: This method does not accept any parameters.

Return value: This method does not return any value.

Example: This example describes how to delete the current range from the document tree.


<!DOCTYPE html>
        HTML DOM range deleteContents() method
    <p>This is the range content.</p>
    <button onclick="del()">
        Click to delete
        var range = document.createRange();
        function del() {


  • Before Click the Button:

  • After Click the Button:

Supported Browsers:

  • Google Chrome
  • Edge
  • Firefox
  • Safari
  • Opera
  • Internet Explorer
My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!