jQuery tags input 使用
来源:互联网 发布:韩略村伏击战知乎 编辑:程序博客网 时间:2024/06/05 09:16
由于项目中想使用tagsinput添加数据,找了很多资源,最终在github上找到开源的项目:
http://bootstrap-tagsinput.github.io/bootstrap-tagsinput/examples/
项目中详细介绍了tagsinput的使用,下面只讲解下添加数据的使用。
1、对于只是添加一个text,就很简单。直接在javascript中使用
$('input').tagsinput('add', 'some tag');
2、如果是想添加对象,那么就稍微复杂一点:
首先在<input>
标签中不能加 data-role=’tagsinput’属性。
然后在在javascript代码中:
var organization = new Bloodhound({datumTokenizer: Bloodhound.tokenizers.obj.whitespace('text'),queryTokenizer: Bloodhound.tokenizers.whitespace,prefetch: 'Resources/xenon/assets/organization.json'//json文件可以是空的,应该只是为了能够保存});organization.initialize();//初始化$('#field-organizationresult').tagsinput({itemValue: 'id',itemText: 'text',typeaheadjs: {name: 'organization',displayKey: 'text',//tagsinput显示的列source: organization.ttAdapter() }}); $('#field-organizationresult').tagsinput('add', {'id':json.id,'text':json.name});//在tagsinput中添加一个对象
0 0
- jQuery tags input 使用
- jQuery tags input 使用
- HTML5-关于如何使用<input>tags~汇总
- jQuery Tags Input Plugin(添加/删除标签插件)
- jQuery Tags Input Plugin(添加/删除标签插件)
- 网页标签功能插: jQuery tags input 翻译api
- thinkphp整合tagit插件和jquery input tags几个插件比较
- 注册 ng-tags-input 失败
- input宽度自适应[使用jquery]
- 基于MVC4+EasyUI的Web开发框架经验总结(1)-利用jQuery Tags Input 插件显示选择记录
- 前端多条件选择插件Tags Input
- jquery的date input日期组件使用
- jquery validate 插件使用隐藏 input
- 使用jquery获取<input>输入的值
- vim+tags 安装使用
- struts-tags的使用
- struts2-jquery, struts-jquery-grid-tags
- jquery easyui - 使用jquery给input赋值,取值
- ios中的绘图机制
- NRV (named return value)
- IHS+Plug-in+WAS SSL单向认证
- 程序设计实践读书笔记(一)
- 转-Android网络(4):HttpClient必经之路----使用线程安全的单例模式HttpClient,及HttpClient和Application的融合
- jQuery tags input 使用
- 一起看妹子(1)
- freeswitch receive rtp audio
- Android开发之——常用验证工具类
- 4比3好
- 线性表
- java hashmap深入分析
- C++primer第五版第十章学习笔记
- 双十一举办100年!TCL还要打破多少销售记录?