My question was automatically deleted by Community. I'd like to undelete it so I can set a bounty on it and see if it attracts answers. I could simply reask it, but a moderator made many changes that improved the question and I think it's unfair to reask and erase his contribution.
If you think the question is OK, please upvote it so Community won't delete it again soon (it has -2 votes at the moment, it needs 0). Honestly, I think it was first downvoted by people who didn't understand JavaScript and what was being asked. They thought I ignored something I explicitly put as an incorrect sollution, but my wording wasn't good at the time, perhaps.
Thanks!
EDIT: Just to be clear, I wouldn't usually assume that people downvoted my question because they didn't understand JavaScript nor my brilliance or whatever. The reason I'm assuming they didn't know JavaScript is that there was a highly voted comment telling me to use event.key
, but I had already said in my original phrasing of the question that event.key
wouldn't work, and I explained why. But this comment was deleted after the question had been downvoted a lot, so one who reads the question now might not know this.
EDIT2: I did Google, I don't know why one would think I didn't. And I also searched SO for it. The main problem is that most of the solutions also suggest deprecated methods (for example, see this), so it doesn't solve the deprecation problem. If you did find a sollution, I'd be very grateful if you could point me to it, but I honestly couldn'y find one, that's why I asked here.
event.key
, but I didn't use it because I specified in the question that it didn't workevent.keyCode
for example is deprecated and thatevent.which
is not the same asevent.key
. I'm sorry, but if you're saying I didn't google, it's your job to prove itevent.which
forevent.key
. You should just read MDN and not ask this". In +- 5 minutes, this comment had 7 upvotes, while my question had 3 or 5 downvotes. In my question, I originally specified thatevent.key
was not the same asevent.which
. MDN must be read with a grain of salt; it didn't say they were interchangeable, but rather that you could, in some cases, use one instead of the other. Downvoting because you don't know JS is what I call "senseless"