Edit This Code:
<!DOCTYPE html>
<html>
<body>

<p>Press a key on the keyboard in the input field to get the Unicode character code of the pressed key.</p>

<input type="text" size="40" onkeypress="myFunction(event)">

<p id="demo"></p>

<script>
function myFunction(event) {
    // Use charCode if the browser supports it, otherwise use event.keyCode (for IE8 and earlier)
    var x = event.charCode || event.keyCode;
    document.getElementById("demo").innerHTML = "The Unicode value is: " + x;
}
</script>

</body>
</html>


Result:
Try it Yourself - © w3schools.com
Privacy Policy