A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://webplatform.github.io/docs/dom/Node/previousSibling below:

previousSibling ยท WebPlatform Docs

previousSibling Summary

Retrieves the previous child node of the parent of the node.

Property of dom/Nodedom/Node

Syntax

Note: This property is read-only.

var previousNode = node.previousSibling;
Return Value

Returns an object of type DOM NodeDOM Node

The previous child node of the parent of the node, or null if the node is the first child.

Examples

This example uses the previousSibling property to obtain the previous sibling of a list item.

<script>

var oSibling = document.getElementById("oList").childNodes[1].previousSibling;
</script>
<body>
 <ul id="oList">
  <li>List Item 1</li>
  <li>List Item 2</li>
  <li>List Item 3</li>
 </ul>
</body>
Related specifications
DOM Level 1
Recommendation
Attributions

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4