How do I get the value of each key pressed and use it in a variable with jQuery? I want to get a key pressed and reveal a certain picture on the page that correlates to that key right when it is pressed. I also ONLY want to target A-Z and “.”
Thanks!
Using jQuery, you can use the
keypressevent, and then convert the character to a string, and match it against your criteria.Here’s a working example:
Update: For the key pressed inside another element, just use the selector
$('#LearnStart'), as seen here.