11m*_*1mb 8 javascript jquery jquery-select2-4
当我下载Select2 的4.0.1 Release Candidate(https://github.com/select2/select2/releases/tag/4.0.1-rc.1)并使用它时,我收到一个JavaScript错误:Uncaught ReferenceError: define is not defined.
在这里我读到它与AMD加载器(我不使用)有关:https://groups.google.com/forum/#!topic/select2/PCQpiJxIIXQ
当我不使用来自RC的jquery.select2.js,而是来自当前主服务器的select2.min.js时:https://raw.githubusercontent.com/select2/select2/master/dist/js/select2 . min.js
有用!
但我很好奇我在这里忽略了什么.我很可能自己做错了什么.
编辑 - 代码示例:
在脑袋里:
<script language='Javascript' src='scripts/jquery-1.9.1.min.js'></script>
<script language='Javascript' src='scripts/jquery.select2.js'></script>
Run Code Online (Sandbox Code Playgroud)
在身体里:
<script type="text/javascript">
$(document).ready(function(){
$('#id_of_select').select2({
tags: "true",
placeholder: "",
allowClear: true,
tokenSeparators: [',', ' ']
});
});
</script>
<select multiple id="id_of_select" name="name[]">
<option value="1" selected="">Option 1</option>
<option value="2" selected="">Option 2</option>
<option value="5">Option 3</option>
</select>
Run Code Online (Sandbox Code Playgroud)
11m*_*1mb 13
好吧,我的不好是..在select2包的文件夹结构中有几个文件夹,包括:
distsrc我使用了src文件夹中的javascript ..但似乎正确的文件在dist文件夹中.
| 归档时间: |
|
| 查看次数: |
5483 次 |
| 最近记录: |