I am a bit confused by the character codes returned by the keyCode property on the keydown event. I was expecting the codes to align with the ascii codes. A lot of them seem to do, but I am getting unexpected results for some: Examples are the delete keys and the '.' key
Using the bellow code: I get the following codes back: DeleteKey: 46 (ASCII val = 127)
DelKey:110
'.' : 190 - which isn't even in the default ascii table.
It seems like the delete key maps to the Ascii code for the '.' key
I am using IE 9 to do the testing.
Is it a misunderstanding on my part that these are supposed to map to the decimal entries in the ascii table?
<script type="text/javascript">
$(document).ready(function () {
$("body").live("keydown", function (e) {
console.log(e.keyCode);
});
});
</script>
<div id="parent">
<span id="target">Test</span>
</div>