surroundContents method (Range)
Places the specified element to surround the contents of the current Range object.
Note: The Range object and its surroundContents method are supported in Internet Explorer from version 9.The contents of the current Range will be inserted after the last child of the specified element. The surroundContents method has a bug in Firefox, it removes the child nodes of the specified element before placing it around a Range.
You can find the related objects in the Supported by objects section below.
|Required. Reference to the element that will be placed around the contents of the current Range object.|
This method has no return value.
Example HTML code 1:
This example illustrates the use of the surroundContents method:
Did you find this example helpful?
User Contributed Comments