How to use javascript to make so that when you press a key in lower case in another element, it appears as a capital letter?

  • one
    Do you need the text on the element to always be displayed in capital letters? Then you can use the css property of the text-transform: uppercase; - Cladoxylon

2 answers 2

 $(function(){ $(document).on('input', '.input', function(){ $('.result').html($(this).val().toUpperCase()); }); }); 
 <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <input type="text" class="input" placeholder="Текст с маленкой буквы"/> <div class="result"></div> 

    The String.toUpperCase() method String.toUpperCase() letters to uppercase.