Populate JQuery TokenInput on AJAX event

早过忘川 提交于 2020-01-07 09:43:51

问题


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.


回答1:


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

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

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

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

Hope it helps.

Thanks



来源:https://stackoverflow.com/questions/22327487/populate-jquery-tokeninput-on-ajax-event

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!