-1

I am fairly new to HTML and I'm starting a new project to help me learn, but I don't know how to detect if a specific key is being pressed and I can't think of anything.

1 Answers1

0

You can not detect such kind of events by using only HTML code. You have to write javascript or jquery code along with your HTML code to archive this functionality.

Below is one of the example of jQuery code where we are increasing value by 1 every time when pressing key on input field.

$("input").keypress(function(){
$("span").text(i += 1);
});

Note: if you want to learn basic, i would like to suggest w3schools.com for the same.

Vivek Jain
  • 317
  • 3
  • 12