<u>
<li></li>
<li></li>
<li></li>
<li></li>
</u>
aA=document.getElementsByTagName('li');
Take out the li element
Then bind the click event
for(var i = 0; i < aA.length; i++) {
aA[i].onclick = function () {
Now I click on the second li element, but I want to find out the adjacent sibling elements of the second li element
Then I used .previousSibling; but what I found was #text, not the first li element.
When I deleted all the spaces in ul, what I found was the first element. element
Then now I want to find the previous sibling element of the li element without deleting spaces. Without using JQ
How to implement this function
previousElementSibling
Go check it out