I'm trying to get through JS the id that has a tag. The id is going to vary, so when doing onClick I have to know it.
<a href="#" role="button" onClick="abrirNoticia();" id="id">Título</a>
As for the function, I was using the following code but the truth is that I'm a little lost:
function abrirNoticia(element){
var parent = element.parentNode;
alert(parent.id);
var content = parent.querySelector("a");
alert(content.id);
}