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

后端 未结 12 2047
失恋的感觉
失恋的感觉 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:24

    Let say your html code is :

    
    

    then the jquery should be :

    $('#txtMyText').keyup(function() {
      this.value = this.value.toUpperCase();
    });
    

提交回复
热议问题