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.
+ There are no comments
Add yours