Edit: This appears to be a known issue in both accessing and removing items. The POST functionality (to provide a set of ids) also is no longer present.
I'm using jQueryUI on my page but haven't found an adaptation of the built-in autocomplete function which will tokenize results Facebook-style. There are a couple plugins built for this purpose and I'm using the loopj package to do this.
I've got it hooked up to my PHP datasource and can pull suggestions and set tokens - I'm just having a problem getting the all-up value from the input. My understa开发者_运维技巧nding is that it is exposed as a list of id's (id and name being the two elements transferred to it via JSON) pertaining to the selected tokens.
Calling the following should (I think) return the value:
var t = $('#tokenizedinputid').val();
...but it comes back undefined. Strangely, if I place this in the onAdd: parameter in initialization, it fires once upon page load and then not when tokens are added. However this example from the demo page fires correctly, upon token addition:
onAdd: function (item) {
alert("Added " + item.name);
},
Is there a way to adapt the above snippet to expose all of the selected tokens? Perhaps using .each()?
Recently added was this patch:
var tokens = $('#tokens').tokenInput('get');
This will return all id/name pairs programatically.
精彩评论