Home >Web Front-end >JS Tutorial >How to convert letters to uppercase and lowercase in jquery?
Letter case conversion method: 1. Use toLowerCase() method to convert uppercase letters to lowercase, the syntax is ""uppercase letters".toLowerCase()"; 2. Use toUpperCase() method to convert lowercase letters to Uppercase, syntax ""lowercase letters".toUpperCase()".
The operating environment of this article: windows10 system, jquery2.2.4, this article is applicable to all brands of computers.
【Related recommendations: jQuery video tutorial】
jquery letter case conversion
1. Convert uppercase to lowercase
"ABC".toLowerCase()//转小写
toLowerCase() method is used to convert a string to lowercase.
2. Convert lowercase to uppercase
"abc".toUpperCase()//转大写
toUpperCase() method is used to convert a string to uppercase.
Use case:
When the input box loses focus, convert the content to uppercase
<div id="app" > <input type="text" id="in"> </div> <script> $('#in').blur(function() { $(this).val($(this).val().toUpperCase()); }); </script>
For more programming-related knowledge, please visit:ProgrammingIntroduction! !
The above is the detailed content of How to convert letters to uppercase and lowercase in jquery?. For more information, please follow other related articles on the PHP Chinese website!