Event if someone clicks and holds the button?

Is it possible to understand when the person pressed the button(input) and keeps it?
April 19th 20 at 12:22
1 answer
April 19th 20 at 12:24
Solution
mousedown / mouseup – when clicked / pressed mouse button on the element.

const element = document.querySelector(".selector");

element.addEventListener("mousedown", () => {
..............
});


const element = document.querySelector(".selector");

element.addEventListener("mouseup", () => {
..............
});


https://learn.javascript.ru/introduction-browser-events

Find more questions by tags JavaScript