setStartBefore
Summary
Sets the start point of a range to a point before a specific node.
Syntax
var result = range.setStartBefore(/* see parameter list */);
Parameters
referenceNode
- Data-type
- DOM Node
Node in the document hierarchy.
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. |
Examples
var range = document.createRange();
var referenceNode = document.getElementsByTagName("div").item(0);
range.setStartBefore(referenceNode);
Syntax
range.setStartBefore(referenceNode);
Standards information
Attributions
Mozilla Developer Network : [Range.setStartBefore Article]
Microsoft Developer Network: [setStartBefore Method Article]