带搜索功能的下拉选择框select2
来源:互联网 发布:仿凡科 源码 编辑:程序博客网 时间:2024/05/21 08:40
api 地址: http://select2.github.io/select2/
<link href="http://select2.github.io/select2/select2-3.5.3/select2.css" rel="stylesheet"><script src="http://select2.github.io/select2/select2-3.5.3/select2.js"></script><script type="text/javascript"> $(document).ready(function() { var data = [{ id: 1, text: '中国' }, { id: 2, text: '美国' }, { id: 3, text: '日本' }, { id: 4, text: '加拿大' }]; $(".js-selecct-example").select2({ data: data, //填充数据 placeholder: "选择国家", //填充默认值 allowClear:true, //是否允许清空 multiple: true, //是否支持多选 ajax:{ url:query_data.url, //输入内容会由服务器查找并返回 dataType: 'json', delay:251, data:function(params){ return { q:param, //输入的内容 pagesize:20, //页面大小 page:page //当前页 }; }, results: function (data, page) { return { results: data.items }; }, cache: true } }); $(".js-select-example").select2('val','1') }); </script> <select class="js-select-example" name="country" multiple="multiple" id="country"> </select>
$('#country').val();
单选结果: 2
效果图如下:
阅读全文
0 0
- 带搜索功能的下拉选择框select2
- 带搜索框选择的下拉列表
- select2 搜索下拉框的用法
- 带搜索功能的下拉框select
- 带搜索功能的下拉框
- Bootstrap选择下拉框的搜索功能
- ztree 带搜索框的 下拉选择树
- jQuery的下拉框搜索select2插件用法
- js实现带搜索功能的下拉框
- magicsuggest 多选以及带搜索功能的下拉框
- yii2下拉框带搜索功能
- 带搜索的下拉框
- 美化的下拉框select2
- jquery 多选下拉菜单、加搜索功能 select2
- 下拉框内容太多,一个带搜索功能的下拉输入框实现
- 可输入的下拉列表(带搜索功能)
- 下拉框带搜索
- 解决select2插件下拉搜索框,输入拼音能够匹配中文汉字的问题
- okhttp封装11111111
- java识别内容链接
- [React]简易留言板
- eclipse开发工具的使用(顶置)
- 平衡二叉树
- 带搜索功能的下拉选择框select2
- Android Studio集成讯飞语音导出可供Unity使用的jar/aar
- 浅谈Memory Reordering
- Intellij IDEA 2017 debug断点调试技巧与总结详解篇
- 【Scikit-Learn 中文文档】监督学习:从高维观察预测输出变量
- could not read data from '/Users/xxxx/xxxx/Info.plist': The file “Info.plist” couldn’t be opened
- Cannot resolve symbol KeyEventCompat(android.support.v4.view.KeyEventCompat找不到)
- Cmake入门教程(三)
- ArrayList转换为字符串