I have all other keys set up using shortKeys in JavaScript like so:
<script type="text/javascript" src="http://rikrikrik.com/js/jquery.shortkeys.js"></script>
$(document).shortkeys({
'U': function () {
$('#imginput').slideToggle(500);
$("#textinput").slideUp(500);
$("#sortPost").slideUp(500);
}});
Now I am trying to set up the escape key, but I dont know how.
I tried:
$(document).shortkeys({
'Esc': function () {
$('#imginput').slideUp(500);
$("#textinput").slideUp(500);
$("#sortPost").slideUp(500);
$('.help_info').fadeOut(500);
}});
and I also tried:
e.keyCode == 27: function () {
$('#imginput').slideUp(500);
$("#textinput").slideUp(500);
$("#sortPost").slideUp(500);
$('.help_info').fadeOut(500);
}});
How would I make it so that these events occur when I press escape?
I don’t know
shortkeysbut using a standardkeyupbinding you can do this:As noted in the
event.whichdocumentation: