I have a function that transforms the text to uppercase on keyup. The code looks like this (I think I found it on SO too):
$(selector).bind('keyup', function (e) {
if (e.which >= 97 && e.which <= 122) {
var newKey = e.which - 32;
e.keyCode = newKey;
e.charCode = newKey;
}
$(this).val((object.val()).toUpperCase());
});
The problem
In Chrome, when I type some text and then try to select it using shift + home, the cursor goes back to the last char, not selecting anything.
I also tested in Firefox and IE and it’s working ok.
Please help me
One of possible solutions is not changing value on every keyup, but just when the value actually changes:
See it in JSFIDDLE.