Keyboard single click multiple events

219 views Asked by At

I am interested in creating a bluetooth remote control with buttons for use with Android phones AND iPhone. Is it possible to press one button once (single click NOT long press) and send multiple key codes?

For example a single click sends a key code for brightness down 20 times in a row. The end result is the screen of the phone dims down to zero brightness.

This could be done by assigning a single key code and performing a LONG press but that would take 2-3 seconds. I want to do this with a single click instead. Any ideas?

1

There are 1 answers

2
teju c On

Have you tried event.preventDefault() on keypresee like below

$('#myID').on('keyup keypress', function(e) {
  var keyCode = e.keyCode || e.which;
  if (keyCode === 13) {
   e.preventDefault();
  }
});