https://www.w3schools.com/jsref/prop_node_previoussibling.aspHTML DOM previousSibling PropertyHTML DOM previousSibling Property Element Object Example Get the HTML content of the previous sibling of a list item: var x = document.getElementById("item2").previousSibling.innerHTML; The result of x will be: Coffee (first li) --> Try it Yourself » Definwww.w3schools.com https://www.w3schools.com/jsre..