Answers for "if event keycode and click"

0

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);
Posted by: Guest on July-29-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language