Home >Web Front-end >JS Tutorial >How to convert letters to uppercase and lowercase in jquery?

How to convert letters to uppercase and lowercase in jquery?

青灯夜游
青灯夜游Original
2020-11-18 15:32:156829browse

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()".

How to convert letters to uppercase and lowercase in jquery?

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>
$(&#39;#in&#39;).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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn