Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to detect arrow keys using JavaScript on iPad with Bluetooth keyboard

Tags:

People also ask

How do I use the arrow keys on my IPAD Bluetooth keyboard?

To activate an item, press the Up and Down Arrow keys together. If this is not possible on your keyboard due to the Up and Down arrows not being able to be pressed at the same time, you can also press the Up, Left, and Right Arrow keys together to achieve the same result.


I cannot find a way to detect arrow keys in a text field in Safari and Chrome on an iPad when a bluetooth keyboard is used.
Using this test HTML and JavaScript, touch the input field to give it focus.
Using the arrow keys nothing happens, but type letters and numbers and the keydown events occur.

<!DOCTYPE html>
<html>
<head>
  <title>Test page.</title>
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
</head>
<body>
  <form>
    <input id="input" style="width: 600px;" type="textarea" />
  </form>
  <div id="keydisp" style="width 600px; height: 50px"></div>
  <script type="text/javascript">
    $(document).keydown(function(event) {
      var keyCode = event.which;
      document.getElementById("keydisp").innerHTML = "key pressed: " + keyCode;
    });
  </script>
</body>
</html>

Is it possible to detect the arrows?