I want to add a hot button to the site. When pressed, it will be recorded "hello" in the field. How to do it?

  • Which field exactly? - LeD4eG

2 answers 2

it's not entirely clear about the "hot button" ... if it is a key on the keyboard, then it has already been written, if it is a button on the site, then somewhere like this:

<button onclick="document.getElementById('pole').innerHTML='Привет!';">Горячая кнопка</button> 

There must be a div or span container with id = "pole"

    event.keyCode - returns the code of the pressed key, you can embed it in the body tag:

      <body onkeydown = "if (event.keyCode == 71) alert ('G is pressed');"> 
    Instead of alert and make a function that will add "Hi" in the desired field.