Keypress event for Japanese text

后端 未结 2 836
余生分开走
余生分开走 2021-01-19 06:07
$(document).ready(function () {
    $(\"#id\").keydown(function () {

    });
})

This code perfectly works for everything(number,alphabet,symbol et

2条回答
  •  醉酒成梦
    2021-01-19 06:26

    There's hardly anything you can do. "Japanese text" means an IME, which is a piece of software intercepting the keyboard input and helping you turn it into Japanese text. How this software interacts or doesn't interact with the browser and the browser's Javascript engine depends on the OS, IME, browser and the browser's Javascript engine. On some platforms the keypress is signaled through, in others it isn't. You can try binding to other events like keyup or keypress, some may be signaled even when using an IME.

    The best you can do is to make sure you're not depending on keypress events and have fallback options if you can't intercept them; e.g. bind to change events on the text field as well and handle entire text changes, which will be triggered at the end of the IME input.

提交回复
热议问题