I want to get the exact location of an html element, and output the address of that element, the logic goes like this.
<div id="foo">
<article>
<div>
<p>you found me</p>
</div>
</article>
<div>
So that is the sample html, now lets say the user click something on that mark up, in this case lets say the user click the 'p' tag. how do I write my JavaScript to output the address of that 'p' tag.
function getAddress(){
// code here
console.log('the user click the ')
console.log(address)
}
Desired output:
// Console
log: the user click the
log: #foo > article > div > p