我有一个用ajax列出的选择框。我想改变语言。我找到了语言插件。我如何在http://www.tes-is.org.tr/assets/plugins/select2/i18n/tr.js使用此功能? 提前致谢
$(".js-data-example-ajax").attr("data-placeholder", "Lütfen Kurum Seçiniz..");
$(".js-data-example-ajax").select2({
minimumInputLength: 3,
language: "tr",
ajax: {
});
答案 0 :(得分:1)
您可以更改select2
默认语言,如下面的示例所示。
$('.select2').select2({
language: "hi"
});

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.5/css/select2.min.css" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.5/js/select2.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.5/js/i18n/hi.js"></script>
<select class="select2">
<option>Search in hindi</option>
<option>एक</option>
<option>दो</option>
<option>तीन</option>
<option>चार</option>
<option>पंज</option>
<option>हम परीक्षण कर रहे हैं</option>
</select>
&#13;