jQuery: How to execute a code after pressing 2 or more keys? -


remember how execute cheat on gta? want execute code in jquery when pressed combination of keys. possible in jquery? example, want display alert when press ctrl + h + e + l + l + o. can teach me how it?

tested , working:

var combo = 'hello'; var keys = []; function onkeyup(evt) {   if (!evt.ctrlkey) return;    keys.push(string.fromcharcode(evt.keycode).tolowercase());   if (keys.length > combo.length) keys.shift();    if (keys.join('') == combo) //you have match  } 

Comments

Popular posts from this blog

html - Difficulties with background-image property -

visual studio code - What does the isShellCommand property actually do and how should you use it? -

ios - Segue not passing data between ViewControllers -