我是新手,需要 js,问题是我不太了解如何加载 jQuery 插件。
我想加载多个插件,但我已经遇到了第一个插件的问题,选择的插件
js
//site full url
var siteUrl = window.location.protocol+"//"+window.location.host + "/";
requirejs.config({
baseUrl: siteUrl + "assets/js",
paths: {
"jquery": "libs/jquery",
"jquery-ui": "libs/jquery-ui",
"bootstrap": "libs/bootstrap",
"scripts": "scripts",
"plugins": "plugins",
},
});
requirejs(['jquery', 'jquery-ui', 'bootstrap', 'plugins/chosen'],
function($, chosen){
$('.chzn-select').chosen();
});
我的测试html
<select data-placeholder="Choose a country..." style="width:350px;" class="chzn-select">
<option value="">Test</option>
<option value="">Test</option>
<option value="">Test</option>
</select>
当我尝试加载它时,我收到以下错误
TypeError: $ is not a function
...tion(){"in"==self.hoverState&&self.show()},self.options.delay.show),void 0):self...
bootstrap.js (line 6)
TypeError: $(...).chosen is not a function
$('.chzn-select').chosen();
有人可以指出我做错了什么吗?