0
Could someone help me understand why I can’t locate the region on the object.
<img src="mapa.jpg" usemap="#image-map" class="img__map">
const map = document.querySelector('.mapa');
const contentMap = {
    sudeste : {
        title : 'Sudeste',
        conteudo : "Lorem ipsum"
    },
    norte : {
        title : 'Norte',
        conteudo : 'Lorem'
    }
}
map.addEventListener('click', function(e){
    e.preventDefault();
    const region = e.target;
    //pego o valor do alt do mapa
    let regiaoNome = region.alt
    //adiciono o valor do mapa com base no nome do alt clicado
    console.log(contentMap.regiaoNome.title)
})
						
It’s confusing the question. You use
document.querySelector('.mapa')but the class of example isimg__map; You want to take the propertyaltbut HTML doesn’t even have that attribute. Nothing is making sense. You could edit your question and explain better what you want?– fernandosavio
If I understand correctly you want to access the title property through the key, try:
contentMap[regiaoNome].title– Marconi
pq there is no contentMap.regiaoName, just contentMap.sudeste and contentMap.norte. What I knowto understand in your question
– HudsonPH