How to convert input text to uppercase while typing using Javascript

Sometimes we need to force the input of text in uppercase in a text field so that the user can only add uppercase letters. With JavaScript, you can automatically convert the value of input when typing. Not only with JavaScript, but we will also discover three different ways to transform the text into uppercase when typing.

Method 1: With JavaScript
<input type="text"  onkeyup="this.value=this.value.toUpperCase()"/>


Method 2: With CSS
<input style="text-transform: uppercase" type="text" />


Method 3: With JQuery
mcqMCQPractice competitive and technical Multiple Choice Questions and Answers (MCQs) with simple and logical explanations to prepare for tests and interviews.Read More How to Define a Variable in PHPHow to Define a Variable in PHPVariables are “containers” that can store specified or determined values, similar to variables in mathematics. These values can be of different types, so-called data types.…Read More

Leave a Reply

Your email address will not be published. Required fields are marked *