I am trying to use a specific key to trigger an event within my page.
here is my js
$(".ryu").keydown(function() { $(".ryu-still").hide(); $(".ryu-cool").show(); }); any idea on how to trigger the event using the "X" key
you need to catch to see if the key being pressed is the right one
$(document).ready(function () { $(".ryu").on('keydown',function(e){ if(e.which==88){ //88 = x key $(".ryu-still").hide(); $(".ryu-cool").show(); } }); }); jsfiddle or it didnt happen http://jsfiddle.net/u3uo7eLn/2/