admin管理员组

文章数量:1323522

How can I get the id, name value pairs of the tokens (entered by a user) via Javascript from the jquery-tokeninput plugin found here?

Is it just me or isnt it surprising that this plugin has a lot of features except a straight forward getEnteredTokens() method?

Thanks in advance.

How can I get the id, name value pairs of the tokens (entered by a user) via Javascript from the jquery-tokeninput plugin found here? https://github./loopj/jquery-tokeninput

Is it just me or isnt it surprising that this plugin has a lot of features except a straight forward getEnteredTokens() method?

Thanks in advance.

Share Improve this question asked Jul 14, 2011 at 17:50 HarindakaHarindaka 4,9088 gold badges47 silver badges66 bronze badges 2
  • On the demo page, you can get the ids using $('#tokeninput-demo').val(): loopj./jquery-tokeninput. – pimvdb Commented Jul 14, 2011 at 17:55
  • Thanks but this would just give me a ma seperated id list wouldnt it? The ids would be of type string and not the original type which was passed via a JSON array (since val() gets the value of the input type=text ). I need the id,name pairs entered as an array and in their original type. – Harindaka Commented Jul 14, 2011 at 18:46
Add a ment  | 

1 Answer 1

Reset to default 7

I know this is kind of late ing, but have you tried:

selector.tokenInput("get");

for example:

var selectedValues = $('#myinputbox').tokenInput("get");

(where selector is whatever jQuery selector you need to return the tokeninput input object) It returns all of the currently selected id/name values in an object.

本文标签: