在一些老项目中可能还有 select2 的身影,在 select option 为空时会显示 “No results found”,那么要如何将 “No results found” 替换为中文呢?
方法很简单,看实例:
$("#mySelect").select2({
language: {
noResults: function(params) {
return "暂无数据";
}
}
});
以上就是 select2 “No results found” 的解决方法。