HTML DOM previousSiblingProperty
Example
Return the node immediately preceding a node:
document.getElementById("item2").previousSibling;
Try it Yourself »
Definition and Usage
The previousSibling property returns the node immediately preceding a node (at the same tree level).
The returned 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 node (at the same tree level), as a node object. |
|---|---|
| DOM Version | Core Level 1 Node Object |
Other Extensions
Element Object