0
我用下面的教程來填充從JSON列表下拉菜單:http://loopj.com/jquery-tokeninput/jQuery的變化檢測值
我特別用下面的代碼:
$(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);
});
});
我希望能夠選擇值一旦一個新的選項被選中