Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/406.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 在固定的div中以列表而不是下拉列表的形式显示google地图建议_Javascript_Jquery_Css_Google Maps Api 3 - Fatal编程技术网

Javascript 在固定的div中以列表而不是下拉列表的形式显示google地图建议

Javascript 在固定的div中以列表而不是下拉列表的形式显示google地图建议,javascript,jquery,css,google-maps-api-3,Javascript,Jquery,Css,Google Maps Api 3,这是动态生成的ul,其中google建议显示为下拉列表 <ul class="ui-autocomplete ui-menu ui-widget ui-widget-content ui-corner-all" role="listbox" aria-activedescendant="ui-active-menuitem" style="z-index: 1; top: -1734.72px; left: 105px; display: none; position: relati

这是动态生成的ul,其中google建议显示为下拉列表

   <ul class="ui-autocomplete ui-menu ui-widget ui-widget-content ui-corner-all" role="listbox" aria-activedescendant="ui-active-menuitem" style="z-index: 1; top: -1734.72px; left: 105px; display: none; position: relative; width: 300px;">


<li class="ui-menu-item" role="menuitem">
<li class="ui-menu-item" role="menuitem">
<li class="ui-menu-item" role="menuitem">
<li class="ui-menu-item" role="menuitem">
<li class="ui-menu-item" role="menuitem">
<li class="ui-menu-item" role="menuitem">
<li class="ui-menu-item" role="menuitem">
<li class="ui-menu-item" role="menuitem">
</ul>
<ul class="ui-autocomplete ui-menu ui-widget ui-widget-content ui-corner-all" role="listbox" aria-activedescendant="ui-active-menuitem" style="z-index: 1; top: 0px; left: 0px; display: none;"></ul>
边距似乎不起作用,而且当我从建议列表中选择任何建议时,它不会显示在输入字段中

此脚本的java脚本代码->

function initialize(){
//MAP
  var latlng = new google.maps.LatLng(41.659,-4.714);
  var options = {
    zoom: 16,
    center: latlng,
    mapTypeId: google.maps.MapTypeId.ROADMAP
  };
   map = new google.maps.Map(document.getElementById("map_canvas"), options);

  //GEOCODER
  geocoder = new google.maps.Geocoder();

  marker = new google.maps.Marker({
   map: map,

    draggable: true

  });

}

jQuery(document).ready(function() {
  initialize();

  jQuery(function() {  
    jQuery("#address").autocomplete({
      //This bit uses the geocoder to fetch address values
      source: function(request, response) {
        geocoder.geocode( {'address': request.term }, function(results, status) {
          response(jQuery.map(results, function(item) {
            return {            
              label:  item.formatted_address,
              value: item.formatted_address,
              latitude: item.geometry.location.lat(),
              longitude: item.geometry.location.lng()
            }
          }));
        })
      },
      //This bit is executed upon selection of an address
      select: function(event, ui) {

        var location = new google.maps.LatLng(ui.item.latitude, ui.item.longitude);
        marker.setPosition(location);
        map.setCenter(location);


        }

    });
  });



});

将此行添加到自动完成属性中

appendTo: "#someElem"
供您参考

为了让利润发挥作用


显示:块

将此行添加到自动完成属性中

appendTo: "#someElem"
供您参考

为了让利润发挥作用


显示:块

你的密码在哪里?不是动态生成的。你发布的代码不够。哪种代码?我想在一个div中绘制这个动态生成的ul。。有可能吗?是的,有可能。我可以帮助你,如果你能至少透露你动态生成代码的部分。我的意思是展示一个用于这一代“ul”的javascript代码示例。我发布了javascript代码,你可以看看:你的代码在哪里?不是动态生成的。你发布的代码不够。哪种代码?我想在一个div中绘制这个动态生成的ul。。有可能吗?是的,有可能。我可以帮助你,如果你能至少透露你动态生成代码的部分。我的意思是展示一个用于这一代“ul”的javascript代码示例。我发布了javascript代码,你可以看看:基本上我想在动态生成的div中获取所有google建议基本上我想在动态生成的div中获取所有google建议