JSFiddle - React, Tailwind, and code Playground

HTML

<div id="location1" class="dot">CLICK 1</div>
<br>
<div id="location2" class="dot">CLICK 2</div>

JavaScript

var locations = {
    location1 : {"name" : "Location 1", "image" : "image1.jpg"},
    location2 : {"name" : "Location 2", "image" : "image2.jpg"}
}


$('.dot').click(function(){
    alert(locations[this.id].name);
});