I need to somehow change the character typed into a different utf8 character and was wondering how it can be achieved with jquery? Basically when some inputs are focused, I want to have English letters typed translated into ot开发者_开发百科her predefined character. Any ideas?
You'll probably need to use a keypress handler. You get the character code from the which
field of the event. You can then map this to the desired character. You could store the mappings in an object:
var mapping = {
"65": "é",
"66": "á"
};
Then, do something like:
var targetChar = mapping[event.which];
精彩评论