Skip to content Skip to sidebar Skip to footer

Force Switch Language To English For An Input Element

OK, here's the stuff: I got one element and I need this element to force switch keyboard layout from ANY other language to Englis

Solution 1:

Do you just mean to only allow alphanumeric characters? If so, you could do something like this.

$('#username').keyup(function() {
                if (this.value.match(/[^a-zA-Z0-9 ]/g)) {
                    this.value = this.value.replace(/[^a-zA-Z0-9 ]/g, '');
                }
            });

As for actually changing the keyboard layout itself, I don't believe that would be possible through javascript...

Post a Comment for "Force Switch Language To English For An Input Element"