I am using the following tutorial to populate a dropdown menu from a json list: http://loopj.com/jquery-tokeninput/
I am particularly using the following code:
$(document).ready(function() {
$("#demo-input-local").tokenInput([
{name: "Ruby"},
{name: "Python"},
{name: "JavaScript"},
{name: "ActionScript"},
{name: "Scheme"},
{name: "Lisp"},
{name: "C#"},
{name: "Fortran"},
{name: "Visual Basic"},
{name: "C"},
{name: "C++"},
{name: "Java"},
{name: "Taranto"}
]);
$("#demo-input-local").change(function(){
var city = // get the selected value on change
console.log(city);
});
});
I want to be able to select the value as soon as a new option is selected