Is it possible to get an id that is under an other id like this:
<p id="moe1" onclick="moe()">Mamamia</p>
<p id="socket1">Pizzaria</p>
So if i know that my id is "moe1", how can i find what is the id under "moe1"?
Is it possible to get an id that is under an other id like this:
<p id="moe1" onclick="moe()">Mamamia</p>
<p id="socket1">Pizzaria</p>
So if i know that my id is "moe1", how can i find what is the id under "moe1"?
you could use CSS adjacent sibling selector
document.querySelector("#moe1 + p").id
or for all elements not only p tags
document.querySelector("#moe1 + *").id
This line of code worked for me:
document.getElementById('moe1').nextSibling;