I have a map element that has multiple areas, and user can select one of those. Each area has an ID that represents a number (which I need to use in an equation later on).
How do I store the ID of selected area in a variable for later use?
My work so far:
function areaSelection(){
$("map").on('click', 'area', function (e){
e.preventDefault();
var areaSelect = parseInt(this.id);
console.log(areaSelect);
});
}
var mapSelection = areaSelection();
$("area").on('click', areaSelection);