我的目标是使用 jQuery 事件 .keyup()将输入的小写字符转换为大写字符。
我怎样才能做到这一点?
最佳答案
普通 ol' javascript:
var input = document.getElementById('inputID');
input.onkeyup = function(){
this.value = this.value.toUpperCase();
}
带有 jQuery 的 Javascript:
$('#inputID').keyup(function(){
this.value = this.value.toUpperCase();
});
关于javascript - 如何使用 'keyup' 事件将小写字符更改为大写字符?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7717099/