You can do this by adapting multiple values on the jQueryUI website.
You will probably get something like this:
function split(val) {
return val.split(/@\s*/);
}
function extractLast(term) {
return split(term).pop();
}
$("#submit_picture_tags").autocomplete({
source: function (request, response) {
var term = extractLast(request.term);
$.ajax({
url: tagsautocomplete,
type: "POST",
dataType: "json",
data: { query: term },
success: function (data) {
response($.map(data, function (item) {
return item;
}));
}
});
},
focus: function () {
return false;
},
select: function (event, ui) {
var terms = split(this.value);
terms.pop();
terms.push(ui.item.value);
terms.push("");
this.value = terms.join(", ");
return false;
},
minLength: 1
});
, , , , : http://jsfiddle.net/RVkjV/