Skip to content
Related Articles

Related Articles

Improve Article
Save Article
Like Article

HTML DOM Range cloneRange() Method

  • Last Updated : 08 Jul, 2020

The cloneRange() method is used to make a clone of original range and returns that cloned Range object it into a new variable.

Note: Change in either Range does not affect the other Range.


newRange = originalRange.cloneRange();

Parameters: This method does not accept any parameter.

Return Value: This method returns the newly created range object.

Example: In this example, a range is cloned. For more clarification of cloned range, a cloned range is converted into string text using toString() method and showed that cloned range object in the console.


<!DOCTYPE html>
        HTML DOM range cloneRange() method
    <p>This is the range.</p>
        originalRange = document.createRange();
        clonedRange = originalRange.cloneRange();

Output: In console, the new cloned range object can be seen.

Supported Browsers: 

  • Google Chrome
  • Edge
  • Firefox
  • Safari
  • Opera

My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!