var teams=[
{key:1, label:"Faizel", type:1},
{key:15, label:"Phumzi", type:1},
{key:2, label:"Julian", type:2},
{key:3, label:"Rydel", type:1},
{key:14, label:"Srdjan", type:2},
{key:5, label:"Doi", type:1},
{key:6, label:"Brandon", type:2},
{key:7, label:"Jose", type:1},
{key:8, label:"Lesley", type:1},
{key:9, label:"Robin", type:1},
{key:10, label:"Bigshow", type:2},
{key:11, label:"Template", type:1},
{key:12, label:"Slab View", type:1},
{key:13, label:"Dulla", type:1},
{key:16, label:"Nelson", type:1},
];
我想基於關鍵是,在文本字段(例如)用戶的輸入,如果在文本字段用戶輸入14的警報應該說「斯爾詹」如何根據用戶的輸入自動顯示警告
使用'alert'顯示警報,否則它只是一個問題去經歷的陣列尋找匹配。 – Richard
您的輸入和事件處理程序在哪裏? – Jai
['Array.prototype.find()'](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/find) – Andreas