setEnd
Summary
Sets the end point of the range.
Syntax
var result = range.setEnd(/* see parameter list */);
Parameters
endNode
- Data-type
- DOM Node
A node in the document hierarchy.
offset
- Data-type
- Number
Specifies the offset value for the end point.
Return Value
Returns an object of type NumberNumber
Type: HRESULT
This method can return one of these values.
Return code | Description |
---|---|
S_OK | The operation completed successfully. |
InvalidStateError | detach has been invoked on the object. |
W3Exception_DOM_INDEX_SIZE_ERR | offset is negative or greater than the number of child units in refNode. |
Examples
var range = document.createRange();
var endNode = document.getElementsByTagName("p").item(3);
var endOffset = document.getElementsByTagName("p").item(3).childNodes.length;
range.setEnd(endNode,endOffset);
Syntax
range.setEnd(endNode, endOffset);
Standards information
Related specifications
- DOM
- Living Standard
Attributions
Mozilla Developer Network : [Range.setEnd Article]
Microsoft Developer Network: [setEnd Method Article]