The 'charCode' property of a keyup event should not be used. The value is meaningless

后端 未结 6 1495
攒了一身酷
攒了一身酷 2021-01-13 07:42

HTML code:

Days

Jquery code:

$(\'#se         


        
6条回答
  •  栀梦
    栀梦 (楼主)
    2021-01-13 07:55

    I tested your code and didn't see the error you mentioned, could you provide code that reproduces this error?

    I was thinking that it could just be the browser you are using...

    keyCode and charCode

    The two properties are keyCode and charCode. Put (too) simply, keyCode says something about the actual keyboard key the user pressed, while charCode gives the ASCII value of the resulting character. These bits of information need not be the same; for instance, a lower case 'a' and an upper case 'A' have the same keyCode, because the user presses the same key, but a different charCode because the resulting character is different.

    Explorer and Opera do not support charCode. However, they give the character information in keyCode, but only onkeypress. Onkeydown and -up keyCode contains key information.

    From quirksmode site, but I don't see you using either in your example code. Are you using them?

提交回复
热议问题