Geek Logbook

Tech sea log book

50projectsIn50days – Day 11: Event Keycode

The purpose of the project is to understand the event “key”. It is supossed you press a key and see in the browser the key you’ve alredy pressed the key code, and the name ol the event.

The html is straightforward. Inside a div named “insert” we have the “key” class

    <div id="insert">
      <div class="key">Press any key to get the keyCode</div>
    </div>

This code is taken in the JavaScript as follow: first we get the element with the id ‘Insert’ after that from the event we take the event.key, event.keycode and event.code.

All this information is added inserted to the innerHTML using the insert function. Quite straigthfortwatd.

You can see the code in this GitHub Repository: 11.event_keycode and the demo of the project is here: Event KeyCodes

Leave a Reply

Your email address will not be published. Required fields are marked *.