Working on a simple hangman game, and I'm trying to catch the user input with the keyup()
, but when I log it to the console I'm realizing something isn't working right... this is my code:
$(document).keyup(function(e) {
userInput = e.value;
console.log(userInput);
});
I also tried doing this, but it isn't working either.
$(document).keyup(function(e) {
userInput = $(this).val();
console.log(userInput);
});
oh, by the way, userInput is a global variable.