I
I
Ilya Famin2020-05-13 05:17:07
JavaScript
Ilya Famin, 2020-05-13 05:17:07

Executing a function after hitting the enter key?

https://jsfiddle.net/fkx87do3/

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Arseny, 2020-05-13
@Fama18122000

function myFunctionmat() {
    console.log('Hello');
}

document.addEventListener('keypress', (e) => {
    if (e.which == 13) {
      myFunctionmat();
    }
});

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question