Help, please, understand why on this page, when you hover the cursor on items that do not have a nested list, the nested lists of other items appear?
We assume that the vehicle attached to the question code
var menu = document.getElementById('catalog_menu'); var inner_ul_collection = menu.querySelectorAll('ul ul'); for(j = 0; j < inner_ul_collection.length; j++) { inner_ul_collection[j].style.display='none'; //console.log(inner_ul_collection[j]); } //ΠΎΠ±ΡΠ°Π±ΠΎΡΡΠΈΠΊ Π½Π°Π²Π΅Π΄Π΅Π½ΠΈΡ Π½Π° ΠΏΡΠ½ΠΊΡ ΠΌΠ΅Π½Ρ menu.onmouseover = function(event){ var target = event && event.target || window.event.srcElement;//ΠΏΠΎΠ»ΡΡΠ°Π΅ΠΌ ΡΠ»Π΅ΠΌΠ΅Π½Ρ-ΠΈΡΡΠΎΡΠ½ΠΈΠΊ ΡΠΎΠ±ΡΡΠΈΡ if(target.tagName == 'SPAN'){ var ul_inner = target.parentNode.parentNode.getElementsByTagName('ul')[0]; ul_inner.style.display="block"; } else{ var ul_inner = target.parentNode.getElementsByTagName('ul')[0]; ul_inner.style.display="block"; } }