我正在尝试使用Jquery自动完成功能,但请获取以下内容:
Timestamp: 5/05/2013 11:45:10 PM
Error: TypeError: jQuery(...).autocomplete is not a function
Source File: xxx/test/wp-content/themes/maths-aust/js-files/checkout-suburb-lookup.js
Line: 31
HTML的负责人看起来很好:
<script type='text/javascript' src='xxx/test/wp-includes/js/jquery/jquery.js?ver=1.7.2'></script>
<script type="text/javascript" src="xxx/test/wp-content/themes/xxx/js-files/jquery-ui-1.10.3/js/jquery-ui-1.10.3.custom.min.js"></script>
<script type="text/javascript" src="xxx/test/wp-content/themes/xxx/js-files/checkout-suburb-lookup.js"></script>
脚本看起来像:
jQuery(document).ready(function() {
jQuery(function() {
jQuery( "#wpsc_checkout_form_22" ).autocomplete({
source: function( request, response ) {
jQuery.ajax({
url: "http://ws.geonames.org/searchJSON",
dataType: "jsonp",
data: {
featureClass: "P",
style: "full",
maxRows: 12,
name_startsWith: request.term
},
success: function( data ) {
response( jQuery.map( data.geonames, function( item ) {
return {
label: item.name + (item.adminName1 ? ", " + item.adminName1 : "") + ", " + item.countryName,
value: item.name
}
}));
}
});
},
minLength: 2,
select: function( event, ui ) {
//
},
open: function() {
jQuery( this ).removeClass( "ui-corner-all" ).addClass( "ui-corner-top" );
},
close: function() {
jQuery( this ).removeClass( "ui-corner-top" ).addClass( "ui-corner-all" );
}
});
});
});
我很难过为什么它找不到自动完成插件!
答案 0 :(得分:0)
我发现了这个问题。原来Wordpress已经包含了UI!