How to change lowercase chars to uppercase using the 'keyup' event?

后端 未结 12 2050
失恋的感觉
失恋的感觉 2021-01-31 01:58

My goal is to use the jQuery event .keyup() to convert inputted lowercase chars to uppercase.

How can I achieve this?

12条回答
  •  一个人的身影
    2021-01-31 02:36

    This worked for me

    jQuery(document).ready(function(){ 
            jQuery('input').keyup(function() {
                this.value = this.value.toLocaleUpperCase();
            });
            jQuery('textarea').keyup(function() {
                this.value = this.value.toLocaleUpperCase();
            });
     });
    

提交回复
热议问题