HOWX USE AN KEY ON A CLICK EVENT code example
Example: if event keycode and click
function advance(event) {
if (event instanceof MouseEvent) {
console.log('clicked');
} else if (event instanceof KeyboardEvent && event.keyCode === 13) {
console.log('enter');
}
}
window.addEventListener('keypress', advance);