Set keyCode attribute to the key element correctly