bethrobson / Head-First-JavaScript-Programming

421 stars 347 forks source link

Chapter 8. Onkeypress is deprecated. #28

Open Bers96 opened 4 months ago

Bers96 commented 4 months ago

Hello everyone! I've got a minor problem with function init(). The Visual Studio Code says that the onkeypress event is deprecated. Could you tell me please what event should be used instead? As far as I managed to learn the onkeydown event fits best. Loads of thanks in advance!

Here is the snippet of code that I'm talking about: function init() { var fireButton = document.getElementById("fireButton"); fireButton.onclick = handleFireButton; var guessInput = document.getElementById("guessInput"); guessInput.onkeypress = handleKeyPress; }