首页
学习
活动
专区
工具
TVP
发布

别先生

爱生活,爱工作。
专栏作者
588
文章
1137174
阅读量
64
订阅数
select2 api参数的文档
// 加载数据 $("#e11").select2({ placeholder: "Select report type", allowClear: true, data: [{id: 0, text: 'story'},{id: 1, text: 'bug'},{id: 2, text: 'task'}] }); // 加载数组 支持多选 $("#e11_2").select2({ createSearchChoice:function(term, data) { if ($(data).filter(function() { return this.text.localeCompare(term)===0; }).length===0) {return {id:term, text:term};} }, multiple: true, data: [{id: 0, text: 'story'},{id: 1, text: 'bug'},{id: 2, text: 'task'}] }); function log(e) { var e=$("<li>"+e+"</li>"); $("#events_11").append(e); e.animate({opacity:1}, 10000, 'linear', function() { e.animate({opacity:0}, 2000, 'linear', function() {e.remove(); }); }); } // 对元素 进行事件注册 $("#e11") .on("change", function(e) { log("change "+JSON.stringify({val:e.val, added:e.added, removed:e.removed})); }) // 改变事件 .on("select2-opening", function() { log("opening"); }) // select2 打开中事件 .on("select2-open", function() { log("open"); }) // select2 打开事件 .on("select2-close", function() { log("close"); }) // select2 关闭事件 .on("select2-highlight", function(e) { log ("highlighted val="+ e.val+" choice="+ JSON.stringify(e.choice));}) // 高亮 .on("select2-selecting", function(e) { log ("selecting val="+ e.val+" choice="+ JSON.stringify(e.choice));}) // 选中事件 .on("select2-removing", function(e) { log ("removing val="+ e.val+" choice="+ JSON.stringify(e.choice));}) // 移除中事件 .on("select2-removed", function(e) { log ("removed val="+ e.val+" choice="+ JSON.stringify(e.choice));}) // 移除完毕事件 .on("select2-loaded", function(e) { log ("loaded (data property omitted for brevity)");}) // 加载中事件 .on("select2-focus", function(e) { log ("focus");}) // 获得焦点事件 .on("select2-blur", function(e) { log ("blur");}); // 失去焦点事件 $("#e11").click(function() { $("#e11").val(["AK","CO"]).trigger("change"); }); 官网文档地址是:http://select2.github.io/select2/#documentation。说再多也没用,最后我们来个实例来证明一下ajax请求远程数据,以截图为准:
别先生
2019-06-05
5.7K0
python的学习和使用
1、python的官网:https://www.python.org/ Python简介: 1、Python 是一个高层次的结合了解释性、编译性、互动性和面向对象的脚本语言。 2、Python 的设计具有很强的可读性,相比其他语言经常使用英文关键字,其他语言的一些标点符号,它具有比其他语言更有特色语法结构。   a、Python是一种解释型语言: 这意味着开发过程中没有了编译这个环节。类似于PHP和Perl语言。   b、Python是交互式语言: 这意味着,您可以在一个Python提示符,直接互动执行写你
别先生
2018-07-31
8250
没有更多了
社区活动
RAG七天入门训练营
鹅厂大牛手把手带你上手实战
Python精品学习库
代码在线跑,知识轻松学
博客搬家 | 分享价值百万资源包
自行/邀约他人一键搬运博客,速成社区影响力并领取好礼
技术创作特训营·精选知识专栏
往期视频·千货材料·成员作品 最新动态
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档