【发布时间】:2017-12-11 11:54:51
【问题描述】:
我在 v4.0.3 中使用 select2
我想将默认语言从英语更改为西班牙语。检查国际化部分中的文档,但如前所述,它对我不起作用。
我很注意你的 cmets anex 代码
$("#multisearch").select2({
language: "es",
closeOnSelect: false,
placeholder: "Comienza tu búsqueda",
data: [
{
id: 0,
text: 'Linea 1',
children:
[{
id: 1,
text: 'San Pablo'
},
{
id: 2,
text: 'Pajaritos'
},
{
id: 3,
text: 'Las Rejas'
},
{
id: 4,
text: 'Ecuador'
}]
},
{
id: 5,
text: 'Linea 2',
children:
[{
id: 6,
text: 'La Cisterna'
},
{
id: 7,
text: 'El Parrón'
},
{
id: 8,
text: 'Lo Ovalle'
},
{
id: 9,
text: 'Ciudad del niño'
},
{
id: 10,
text: 'Pajaritos'
}
]
},
{ id: 1, text: 'prueba' },
]});
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.js"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.3/css/select2.min.css" rel="stylesheet" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.3/js/select2.min.js"></script>
<select multiple id="multisearch" style="width:500px">
</select>
我会注意的,非常感谢
【问题讨论】:
-
这个问题有解决你的问题 "stackoverflow.com/questions/35816137/…"
标签: javascript jquery jquery-select2