Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

javascript get keycode from char

//You can use the charCodeAt function to achieve this.
//example

//js file
function showKeyCode () {
    var character = document.getElementById("character").value.substring(0, 1);
    var code = document.getElementById("character").value.charCodeAt(0);
    var msg = "The Key Code for the "" + character + "" character is " + code + ".";
    alert(msg);
}
//html file
<input type="text" id="character" size="15">
<input type="button" value="Show Key Code" onclick="showKeyCode();">
Comment

PREVIOUS NEXT
Code Example
Javascript :: rounding off in javascript 
Javascript :: html javascript call function after pressing enter 
Javascript :: Using "requireCordovaModule" to load non-cordova module "xcode" is not supported 
Javascript :: how to add a shadow react native 
Javascript :: react native get navigation bar height 
Javascript :: jquery disable keypress 
Javascript :: hide label chratjs 
Javascript :: extract numbers from a string javascript 
Javascript :: How to make "select option" select option for quantity 
Javascript :: get 5 months after date in javascript 
Javascript :: javascript array of zeros of n length 
Javascript :: Javascript console log a int 
Javascript :: javascript remove last character in a string 
Javascript :: import json file python online 
Javascript :: jquery debounce 
Javascript :: if media queries jquery 
Javascript :: today in moment 
Javascript :: committing only some changes to git 
Javascript :: delete all node modules 
Javascript :: s3.getobject nodejs example async await 
Javascript :: how to add jquery in js file 
Javascript :: js transform 
Javascript :: moment month start date and end date 
Javascript :: cypress display timestamp in milliseconds 
Javascript :: make ajax calls with jQuery 
Javascript :: javascript check if boolean is undefined 
Javascript :: nuxt head script content 
Javascript :: find string in array javascript 
Javascript :: splidejs pause 
Javascript :: nodejs format text 
ADD CONTENT
Topic
Content
Source link
Name
5+2 =