HTML DOM previousSibling Property
Example
Returns the node immediately preceding a given node:
document.getElementById("item2").previousSibling;
Try it »
Definition and Usage
The previousSibling property returns the node immediately preceding a given node (at the same tree level)
The node is returned as a node object.
**Note:** If this node does not exist, the property returns null.
Browser support





All major browsers support the previousSibling property
Syntax
node
.previousSibling
Technical Details
| Return Value: | The node immediately preceding a given node (at the same tree level), returned as a node object |
|---|---|
| DOM version | Core Level 1 Node Object |
Element object