If you want the ID of the input you can do this this.attr("id")
:
$(document).ready(function () {
$("#demo-input-pre-populated").tokenInput("http://shell.loopj.com/tokeninput/tvshows.php", {
prePopulate: [{
id: 123,
name: "Slurms MacKenzie"
}, {
id: 555,
name: "Bob Hoskins"
}, {
id: 9000,
name: "Kriss Akabusi"
}],
onAdd: function (item) {
console.log(this.attr("id"));
// Input ID (this refers to the jQuery input object)
},
});
});