Creates an empty Range instance object that has both of its boundary points positioned at the beginning of the document. After a Range is created, you must set its starting and ending boundary points before you can make use of most of its methods.
var range = document.createRange();
Returns an object of type DOM NodeDOM Node
An empty Range instance object.
//create a document range var myRange = document.createRange(); //set starting and ending boundaries using predefined objects and variables myRange.setStart(startNode, startOffset); myRange.setEnd(endNode, endOffset);
- DOM Level 2 Traversal and Range