简体   繁体   English

在Google Maps Infowindow中使用jQuery

[英]Using jQuery in Google Maps infowindow

I want to use the fcbk_autocomplete function I downloaded from http://www.emposha.com/javascript/fcbkcomplete.html in Google Maps infowindow . 我想用fcbk_autocomplete功能我从下载http://www.emposha.com/javascript/fcbkcomplete.html在谷歌地图infowindow

Originally I have set the content of infowindow as shown below 本来我已经设置了infowindow的内容,如下所示

var friends = document.getElementsByTagName('option'), 
    res = '';

for (var i = 0; i < friends.length; i++) {
    res = res + '<option value="'+friends[i].id+'">' + friends[i].value + '</option>';
}

var contentString = '<form method="post" action="mapit.do">' 
    + '<textarea name="comment" cols="40" rows="5">Enter your gossips here...</textarea><br>'
    + 'image url: <input type="text" cols="40" name="url"></input><br>'
    + '<input type="hidden" name="position" value="' + event.latLng.toUrlValue() + '"/>'
    + '<select id="select3" name="about">' + res + '</select>'
    + '<input type="submit" value="Submit" />'
    + '</form>';

options is a list of data I want to select from and they are stored in an invisible division. options是我要从中选择的数据列表,它们存储在不可见的分区中。

After I open the infowindow, I tried to call the fcbkcomplete function by: 打开信息窗口后,我尝试通过以下方式调用fcbkcomplete函数:

$("#select3").fcbkcomplete({
    addontab: true,                   
    maxitems: 10,
    input_min_size: 0,
    height: 10,
    cache: true,
    newel: true,
});

But it has no effect on the select3 section. 但这对select3部分没有影响。 I tried to call document.getElementById("select3") and it gives me null. 我试图调用document.getElementById("select3") ,它给了我null。 My question is where can I call this function to make sure it sees the element with id select3? 我的问题是,在哪里可以调用此函数以确保它看到ID为select3的元素?

It is hard to emulate without google maps loaded and everything, but I started a jsFiddle for you here . 没有加载Google地图和所有内容,很难模拟,但是我在这里为您启动了jsFiddle

The plugin you're attempting to use appears to be working in my context; 您尝试使用的插件似乎在我的上下文中有效; however, that may not explain the behavior you've witnessed with attempting to use it within a gmap info window . 但是,这可能无法解释您在gmap info window尝试使用它所看到的行为。 Nevertheless, if you want you can add your gmap stuff to the javascript source and I can help you debug from there. 不过,如果您愿意,可以将gmap内容添加到javascript源中,我可以帮助您从那里进行调试。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Google Maps和jQuery InfoWindow替换 - Google Maps & jQuery InfoWindow Replacement 在jQuery移动框架上使用Google Maps将infoWindow添加到标记中 - Adding infoWindow to markers using Google Maps on jQuery mobile framework Google Maps InfoWindow,使用jQuery取消子元素的样式 - Google Maps InfoWindow, Undo styling on childelements using jQuery 如何使用ajax和jquery在Google地图的信息窗口内提交表单 - how to submit a form inside the infowindow of google maps using ajax and jquery 使用 addEventListener 处理带有 jQ​​uery UI 地图的 Google 地图信息窗口内选择器上的 jQuery 单击事件 - Using addEventListener To Handle jQuery Click Events On Selectors Inside Google Maps infoWindow With jQuery UI Maps 如何在Google地图InfoWindow中使用Jquery? - How to use Jquery inside Google maps InfoWindow? 如何在Infowindow谷歌地图上添加jQuery slimScroll - How to add jquery slimScroll on infowindow google maps 谷歌地图+ jQuery自动关闭最后一个信息窗口 - google maps + jquery auto close last infowindow jQuery Google Maps-单击时打开信息窗口 - jQuery Google Maps - open infowindow on click Google Maps InfoWindow内容 - 点击动态加载(使用jquery-ui-maps) - Google Maps InfoWindow Content - dynamic loading on Click (using jquery-ui-maps)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM