I am trying to call a JS function on a button placed in the info window of map marker and pass the SFDC id to it, But the JS is giving me a syntax error. Here's my piece of code-
for(var i=0, j=mapData.length; i<j; i++){
//Add marker for each point
var myLatlng = new google.maps.LatLng(mapData[i].lat, mapData[i].lng);
var markercolor= mapData[i].markerText;
console.log(markercolor);
if (markercolor.startsWith("00Q")){
var contentString = '<a href="/'+ mapData[i].markerText + '" target="_blank">'+mapData[i].name+'</a>'+'<br/>'+
mapData[i].Street+',' +'<br/>'+ mapData[i].City +',' +'<br/>'+ mapData[i].State +'<br/>'+
"<input type='submit' id='butSubmit' value='Edit' onclick='openVFWindow("+mapData[i].markerText+")' >";
}
addMarker({position: myLatlng, markerText: contentString , color: markercolor});
}
JS function-
function openVFWindow(markerid) {
console.log('iddddddddd'+markerid);
}
So markerText has the Salesforce id of the record and its getting populated correctly. When I click on the console, the error is shown as
Uncaught SyntaxError: Invalid or unexpected token with the error line -openVFWindow(00Qg000000CcEezEAF)