How to change lowercase characters to uppercase using the keyup event with JavaScript?

Estimated read time 1 min read

You can use the keyup event in JavaScript to listen for when a user releases a key on their keyboard, and then use the toUpperCase() method to convert any lowercase characters in the input to uppercase characters. Here’s an example using vanilla JavaScript:

let input = document.getElementById("input");

input.addEventListener("keyup", function() {
  this.value = this.value.toUpperCase();

And here’s the HTML code for the input:

<input type="text" id="input">

With this code, whenever a user releases a key in the input, the value of the input will be converted to uppercase.

You May Also Like

More From Author

+ There are no comments

Add yours

Leave a Reply