Categories
JavaScript Answers

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

Spread the love

Sometimes, we want to change lowercase characters to uppercase using the keyup event with JavaScript.

In this article, we’ll look at how to change lowercase characters to uppercase using the keyup event with JavaScript.

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

To change lowercase characters to uppercase using the keyup event with JavaScript, we set the value to upper case with toUpperCase.

For instance, we write

const input = document.getElementById("inputID");

input.onkeyup = (e) => {
  e.target.value = e.target.value.toUpperCase();
};

to get the input with getElementById.

Then we set its onkeyup property to convert the input value to upper case with toUpperCase.

We then assign the returned string back to e.target.value to update the string.

Conclusion

To change lowercase characters to uppercase using the keyup event with JavaScript, we set the value to upper case with toUpperCase.

Leave a Reply

Your email address will not be published.

If you like the content of this blog, subscribe to my email list to get exclusive articles not available to anyone else.