Convert key code to char
Description
The following code shows how to convert key code to char.
Example
<html>
<head>
<script
src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(<!--from ww w. j a v a 2 s . c o m-->
function() {
$("input").keypress(
function(e) {
var c = String.fromCharCode(e.which);
$("p").append($("<span/>")).children(":last")
.append(document.createTextNode(c));
$("div").text(e.which);
});
});
</script>
</head>
<body>
<input type="text" />
<p>Add text -</p>
<div></div>
</body>
</html>