Reputation: 14632
Create the following html-page:
<textarea id="code" rows="10"></textarea>
<script>
document.onkeydown = function(event) {
alert(event.keyCode);
}
</script>
Open it on Mobile Safari (on a simulator or on a device with keyboard), tap on textarea to start editing. And now press any arrow key - event won't fire.
How to detect key down for arrow keys?
P.S. Related issue on Apple Bug Report system: 13243285
Upvotes: 5
Views: 2568
Reputation: 14632
Official answer from Apple:
Thank you for contacting Apple Developer Technical Support (DTS). Our engineers have reviewed your request and have concluded that there is no supported way to achieve the desired functionality given the currently shipping system configurations.
Upvotes: 11
Reputation: 4318
$(selector).keydown(function(e){
if (e.keyCode == 37) {
alert( "left pressed" );
return false;
}
});
Character codes:
37 - left
38 - up
39 - right
40 - down
Upvotes: 1