Open In App

How to change Input characters to Upper Case while typing using CSS/jQuery ?

Given an input text area and the task is to transform the lowercase characters into uppercase characters while taking input from user. It can be done using CSS or JavaScript. The first approach uses CSS transform property and the second approach uses JavaScript to convert the lowercase character to upper case character.

Approach 1: This approach uses CSS text-transform property to transform the lowercase characters into uppercase characters while taking input from the user.



Example: This example implements the above approach.




<!DOCTYPE HTML> 
<html
  
<head
    <title
        How to change Input character
        to Upper Case while typing
        using CSS/JavaScript ?
    </title>
</head
  
<body style = "text-align:center;">
      
    <h1 style = "color: green"
        GeeksForGeeks 
    </h1>
      
    <p id = "GFG_UP" style =
        "font-size: 20px; font-weight: bold;">
        Type in the input box in lower
        case to see the effect.
    </p>
      
    Type Here: <input id="yourid" 
        style="text-transform: uppercase"
        type="text" />
      
    <br><br>
      
    <p id = "GFG_DOWN" style = "color:green;
        font-size: 26px; font-weight: bold;">
    </p>
</body
  
</html>

Output:

Approach 2:



Example: This example implements the above approach.




<!DOCTYPE HTML> 
<html
  
<head
    <title
        How to change Input character
        to Upper Case while typing
        using CSS/JavaScript ?
    </title>
      
    <script src=
    </script>
</head>
  
<body style = "text-align:center;"
      
    <h1 style = "color: green"
        GeeksForGeeks 
    </h1>
      
    <p id = "GFG_UP" style
        "font-size: 20px; font-weight: bold;">
        Type in the input box in lower
        case to see the effect.
    </p>
      
    Type Here: <input id="yourid" type="text" />
      
    <br><br>
      
    <script>
        $(function() {
            $('input').keyup(function() {
                this.value = this.value.toLocaleUpperCase();
            });
        });
    </script
</body
  
</html>

Output:


Article Tags :