なぜこれが機能しないのですか?
var holdingctrl = false;
$(document).keydown("q",function(e) {
if(holdingctrl == true)
alert("Holding CTRL and pressing Q: Success.");
e.preventDefault();
});
$(document).keyup("q",function(e) {
holdingctrl == false
});
以下の例は問題なく動作しますが、上記の何が間違っているのでしょうか?
$(document).keyup("q",function(e) {
alert("ONLY pressing Q: Success.");
});