js previous element sibling
snippet in javascript

js previous element sibling

user1558

// This will get the element that was just before item2
var x = document.getElementById("item2").previousElementSibling;