I want to convert full-width alphanumeric characters entered in the chrome text box into half-width characters in real time using javascript.

Asked 2 years ago, Updated 2 years ago, 85 views

Look for some reference sites and
http://qiita.com/yoya_k/items/4bce6201fde9ee3a9561

I managed to make it closer while using this as a reference, but
What bothered me was that there was not much information in the first place because there was another way?
I was surprised because I thought there might be more people who are worried about this problem.

If you can't use the image-mode, I hope you understand the basic method.
Even if the input mode is full-width, I want to be able to input only half-width numbers (immediate conversion?).
If possible, I would like to use jquery and angularjs.
Thank you for your cooperation.

javascript jquery angularjs

2022-09-30 17:04

3 Answers

In real time... means you want to control IME behavior, right?

That's what I'm.
In my opinion, the reason for the lack of information in the first place is that such control is not desirable.
(I remember being advised to abolish even the image-mode.)

For example, some users will not be able to enter a zip code dictionary even if they want to.
You'll be very surprised if you say, "Oh? Why did you enter it without permission?"
It should not be done from a usability perspective.
Normally, you should verify that you have entered the pattern attribute or $watch.


2022-09-30 17:04

Get the key type onkeydown and do preventDefault.


2022-09-30 17:04

As for the reference site method, it cannot be used on Firefox, so
It's not very practical.
http://qiita.com/yoya_k/items/4bce6201fde9ee3a9561


2022-09-30 17:04

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.