我在得到一個keyup事件的幾個問題,以火在我的iPhone keyup事件,我的代碼如下:jQuery的:移動設備
var passwordArray = ["word", "test", "hello", "another", "here"];
var test = document.getElementById('enter-password');
test.addEventListener('keyup', function(e) {
if (jQuery.inArray(this.value, passwordArray) != -1) {
alert("THIS IS WORKING");
} else {}
});
的想法是,當用戶鍵入到#enter-password
字段,因爲當他們匹配passwordArray
中的單詞時,警報將觸發。這適用於桌面,例如一旦輸入word
,只要輸入d
,該功能就會立即啓動。無論如何也得到這個爲移動工作嗎?