Switch between input methods between HTML input fields

I have an HTML form with two text input fields.

When a user moves from the first field to the second, I would like to automatically switch the user input method to another, say, a different language.

The reason I'm trying to do this is because I expect the user to type content in different languages โ€‹โ€‹in each field.

I tried <input lang="JA" /> but didn't seem to change the input method in Safari for Mac and iOS.

Is it possible in HTML or JavaScript to change the input method based on each field?

+3
javascript html input text
source share
1 answer

Input methods are controlled by the browser and user. The lang attribute does not affect this, and there is no other way to HTML. It would be impractical to change the input method for each document, to a lesser extent, for each field, from the method usually used in the browser and accepted by the user (either silently or figuring out how to manage such things).

In some situations, it may be useful to provide special tools to users - not to redefine input methods, but to offer additional features. For example, if the expected language is written in Latin letters with a few additional letters in addition to the base az, you may have buttons for entering them (to help people using keyboards that do not have a convenient way to enter them).

You can create controls that act as input method editors; see, for example, typd.in for Japanese input. But that means using something on top of the input methods that the user uses.

+1
source share

All Articles