Google地图自动完成功能无效。显示类型错误:a为空错误。 这是我的代码:
<div class="input-wrapper">
<input id="location" style="width: 350px;" class="location" type="text"
value="<?php echo translate("Where_do_you_want_to_go"); ?>" name="location"
autocomplete="off" onblur="if (this.value == ''){this.value = '<?php echo translate("Where_do_you_want_to_go"); ?>'; }"
onfocus="if (this.value == '<?php echo translate("Where_do_you_want_to_go"); ?>') {this.value = ''; }"
placeholder="<?php echo translate("Where_do_you_want_to_go"); ?>">
<p id="enter_location_error_message" class="bad" style="display:none;"> Please set location </p>
</div>
这是我的jQuery:
$(document).ready(function () {
var input = document.getElementById('location');
autocomplete = new google.maps.places.Autocomplete(input);
google.maps.event.addListener(autocomplete, 'place_changed', function() {
});
});
我试图解决这个问题。