Skip to content Skip to sidebar Skip to footer

Change KeyCode In Javascript In Google Chrome

i am using javascript to change KeyCode for automatic convert keybourd into persian keyboard. my code is shown in below function submitenter(myfield, e) { var key; if(windo

Solution 1:

keyCode is read only according to the MDN documentation which also states that this property is deprecated and recommends using event.key instead.

You might find Firing a Keyboard Event in JavaScript and KeyboardEvent in Chrome, keyCode is 0 useful in creating a custom event for Firefox and Chrome respectively.

The custom event workaround for Chrome in particular is required because creating normal KeyboardEvents is bugged.


Post a Comment for "Change KeyCode In Javascript In Google Chrome"