在AJAX事件中填充JQuery TokenInput [英] Populate JQuery TokenInput on AJAX event

查看:164
本文介绍了在AJAX事件中填充JQuery TokenInput的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设jQuery TokenInput附加了一个文本字段,该文本字段具有在初始化期间定义的预填充参数.

Let say a jQuery TokenInput is attached with a text field with a pre populate parameter defined during its initialization.

现在,我想在事件触发器上用一些令牌填充该输入字段,而无需重新初始化此插件.

Now I want to populate that input field with some tokens on an event trigger without re-initialization of this plugin.

推荐答案

我找到了工作的解决方案.这就是为什么我在这里发布信息,以便其他人可以从此答案中受益.

I have found the solution of my work. Thats why I am posting here so that others can benefit from this answer.

假设职业是我的ID为职业"的领域.

Let say Occupation is my field with id "occupation".

$("#occupation").tokenInput("add", {id: 1, name: "Software Engineer"});

"add"是一种功能,可将JSON记录作为令牌动态添加.

"add" is a function which adds the json record as a token on the fly.

希望有帮助.

谢谢

这篇关于在AJAX事件中填充JQuery TokenInput的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆