Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/73.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript Google.maps.event.addListener for click and dragend不';不行?_Javascript_Jquery_Google Maps - Fatal编程技术网

Javascript Google.maps.event.addListener for click and dragend不';不行?

Javascript Google.maps.event.addListener for click and dragend不';不行?,javascript,jquery,google-maps,Javascript,Jquery,Google Maps,我有这样的代码:“click dragend”事件的函数()中的代码没有执行,文档中的latFld和llgFld没有更新,我该怎么办 演示和完整代码: 首先,在小提琴中的示例代码中,autocomplete未定义,因此导致错误。据我所知,一次不能绑定多个事件,因此必须显式绑定它们 //So instead of google.maps.event.addListener(map, 'click dragend', function (event) { ... // You would wan

我有这样的代码:“click dragend”事件的函数()中的代码没有执行,文档中的latFld和llgFld没有更新,我该怎么办

演示和完整代码:


首先,在小提琴中的示例代码中,
autocomplete
未定义,因此导致错误。据我所知,一次不能绑定多个事件,因此必须显式绑定它们

//So instead of 

google.maps.event.addListener(map, 'click dragend', function (event) { ...
// You would want to do this
google.maps.event.addListener(map, 'click', function (event) { ...
// and
google.maps.event.addListener(marker, 'dragend', function (event) { ...
还请注意,您不能从地图的
dragend
获取latLng,而是从标记获取latLng,因此在
dragend
侦听器中,它被绑定到
标记
看看更新的小提琴,看看我的意思

//So instead of 

google.maps.event.addListener(map, 'click dragend', function (event) { ...
// You would want to do this
google.maps.event.addListener(map, 'click', function (event) { ...
// and
google.maps.event.addListener(marker, 'dragend', function (event) { ...