Challenge Project - Number Guesser - problem with alert functionality

Hello, I have such a problem with alert function - it informs, that number is out of range, but the number is input anyway. I think, the wrong number should be cancelled, and program should be ready to input the new number. However I don’t know how to fix it, and will be grateful for some tips.
Below there are links to code and live site.

https://golankiewicz.github.io/ProjectNumberGuesser/index.html
Best regards
Pawel