Goodnight. Today, on Yandex, I saw such a chip, when you start entering a password using the Russian keyboard layout, the red inscription “Change Layout” appears. How can this be implemented? How can I check the correct keyboard layout?
|
1 answer
It is quite simple to check the input string for the occurrence of Russian alphabet characters using regexp.
- More specifically, you can write? - spoilt
- fiveSo try: $ ('# txt'). Keyup (function (e) {if ($ (this) .val (). Match (/ ([AZA-ZA) +) /)) {alert ('Change layout ');}}); - Deonis
- oneSo also not quite right.
[А-ЯЁ][а-яё]
will also catch the letter e, which in Unicode is in another block. - pirj
|