我的异常是
Uncaught TypeError: Object [object Object] has no method 'geocomplete'
每当我尝试将instantclick.js
包含在页面上时。该页面有一个自动填充框来搜索地点,如下所示:
<input type="text" placeholder="Start Typing Your Location" id="geocomplete"
autocomplete="off" class="chkmeloc" onblur="validatefoem()"/>
instantclick.js
和geocomplete.js
包含如下:
<script src="http://maps.googleapis.com/maps/api/js?sensor=false
&libraries=places"></script>
<script src="<?php echo $dir; ?>js/jquery.geocomplete.js"></script>
<script>
$(function(){
$("#geocomplete").geocomplete({
map: ".map_canvas",
details: "form",
types: ["geocode", "establishment"]
});
$("#find").click(function(){
$("#geocomplete").trigger("geocode");
});
});
</script>
<script src="js/instantclick.min.js" data-no-instant></script>
<script data-no-instant>InstantClick.init();</script>
<style>
#instantclick-bar {
background: #ed3e49;
color: #ed3e49;
}
</style>
我还尝试将data-no-instant
标记添加到脚本中但是徒劳无功。请帮我识别问题。
当我在一次加载后再次刷新页面然后它工作正常..看起来它没有第一次加载