function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
prasanth sfdcprasanth sfdc 

lightning:map on click of address not able to get value

Hi,
  I am displaying map in lightning component using lightning:map tag. on click of the address at the left side i am not able to get the address information in javscript controller.  Please help me to sort this. 
 
<lightning:map mapMarkers="{!v.mapMarkers}" zoomLevel="{!v.zoomLevel}"  onclick="{!c.onclickofMap}" />
 
onclickofMap:function(component,event,helper)
    {
      //  alert('The event is:'+JSON.stringify(event));
       // var locationNameVal =  event.getParam("v.value");
      //  var temp =  component.find("mapvals").get("v.value");      
        //  var id = event.currentTarget.dataset.id; //it will return thisDiv
  //  var getTargetedButton = component.find(id); //it will return the source button

        var res = null ;
        var oTarget = event.target ;
        if (oTarget.attributes[title] != null)
        {  
            alert('The oTarget is:' +oTarget);
            res = oTarget.attributes[title].value;
         
        }
        else
        {
            for (var i = 0; i < oTarget.attributes.length; i++)
            {
                if (oTarget.attributes[i].name === title)
                    res = oTarget.attributes[i].value;
                 alert('coming here: '+res+'.....');
            }
        }
       
    }

User-added imageUser-added image