[英]Using handlebar I get this error :Uncaught TypeError: $(…).geocomplete is not a function
I am using this html code that I am trying to implement onto my handlebar file. 我正在使用要尝试在我的车把文件上实现的html代码。 While it works on the html/javascript file, I can't get it to work in the handlebar file. 虽然它可以在html / javascript文件中运行,但无法在车把文件中运行。
When I use it in the handlebar, I get this error : Uncaught TypeError: $(...).geocomplete is not a function 当我在车把上使用它时,出现以下错误:Uncaught TypeError:$(...)。geocomplete不是一个函数
I am putting the code into main.handlebar: 我将代码放入main.handlebar中:
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script src="js/jquery.geocomplete.js"></script>
<script language = "javascript">
$(function(){
$("#geocomplete").geocomplete().bind("geocode:result", function(event, result){
$.log("Result: " + result.formatted_address);
})
.bind("geocode:error", function(event, status){
$.log("ERROR: " + status);
})
.bind("geocode:multiple", function(event, results){
$.log("Multiple: " + results.length + " results found");
});
});
</script>
and it is not recognizing .geocomplete() method that is in js/jquery.geocomplete.js 并且无法识别js / jquery.geocomplete.js中的.geocomplete()方法
It recognizes it in a html file though. 它可以在html文件中识别它。
获取您的Google Maps JavaScript API的API密钥,然后将您的API密钥放入
<script src="https://maps.googleapis.com/maps/api/jskey=API_KEY_HERE&libraries=places"></script>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.