JSFiddle - React, Tailwind, and code Playground
HTML
<div id="location0" class="dot"></div>
CSS
#location0{
position: absolute;
left: 100px;
top: 100px;
width: 15px;
height: 15px;
background-color:#CC0000;
cursor:pointer;
}
JavaScript
var location0 = {"name" : "Location 1", "image" : "image1.jpg"};
$('.dot').click(function(){
var thisLocation = $(this).attr("id");
alert(thisLocation); //Returns "location0"
alert(thisLocation["image"]); //Returns "undefined"
});