当用户使用javascript键入时,我想将小写字母转换为大写.欢迎任何建议.
我尝试过以下方法:
$("#textbox").live('keypress', function (e) {
if (e.which >= 97 && e.which <= 122) {
var newKey = e.which - 32;
// I have tried setting those
e.keyCode = newKey;
e.charCode = newKey;
}
});
Run Code Online (Sandbox Code Playgroud)