我正在使用以下教程从 json 列表中填充下拉菜单:http: //loopj.com/jquery-tokeninput/
我特别使用以下代码:
$(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);
});
});
我希望能够在选择新选项后立即选择值