onkeypress event in javascript not showing the unicode(hindi/remingtongail) character it is only alerting 'r' on pressing a key.
i am using hindi indic input 3 toolbar to type in laptop.
my javascript code is

function validate(){
var string=event.key;
c = string.charCodeAt(1);
var xyx=String.fromCharCode(c);
alert(xyx);
}

My html text area code is

<textarea onkeydown="validate()"></text area>

Per Mozilla documentation:

The keydown event is fired when a key is pressed. Unlike the keypress event, the keydown event is fired for all keys, regardless of whether they produce a character value. The keydown and keyup events provide a code indicating which key is pressed, while keypress indicates which character was entered.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.