<ul id="ul">
    <li></li>
    <li></li>
    <li></li>
    <li></li>
</ul>
<script>
    let ul = document.getElementById("ul");
    ul.onclick = (e) => {
        let target = e.target;
        let parent = target.parentNode;
        for(let i = 0; i < parent.children.length; iPP){
            if(target == parent.children[i])
                return i
        }
    }
</script>
now I use the for loop to find the corresponding node and get the location, which is a bit strange. Do you have any other ideas?
