jquery - How to make a div appear with JavaScript with keypresses -


this question has answer here:

i want show/enable div whenever type key-combination in right order.

for example: 'open console{enter}' now, there no input field, no nothing. open site, type text , div should pop up. such 'secret menu'.

how can accomplish without actual inputfield?

also, pros , cons?

$(document).on("keypress", function (e) {     if(e.which == 13) {         $("#div").show();     } }); 

example: http://jsfiddle.net/ve6crpne/

e.which key. if key 13 (enter/return) show div id = div.

if wish detect multiple keys in row, add each key map , check afterwards. duplicate question, can seen here: detect multiple keys on single keypress event in jquery - simple.


Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -