Add Marker function with Google Maps API

前端 未结 5 1443
梦如初夏
梦如初夏 2020-11-29 06:45

I have the following Javascript that includes both the standard Google Maps API initialize() function and custom addMarker() function. The map will

5条回答
  •  误落风尘
    2020-11-29 07:12

    You have added the add marker method call outside the function and that causes it to execute before the initialize method which will be called when google maps script loads and thus the marker is not added because map is not initialized Do as below.... Create separate method TestMarker and call it from initialize.

    
    

提交回复
热议问题