Javascript methods toLowercase() and toUppercase() can be used to make text in your HTML page in upper or lower case respectively.
Syntax: toLowercase() : JavaScript method to convert text case form uppercase to lowercase.
Syntax: toUppercase() : JavaScript method to convert text case form lowercase to uppercase.
Example:
<html>
<head>
<title>JavaScript : Convert text from uppercase to lowercase or lowercase to uppercase.</title>
</head>
<body>
<input type="text" style="width:300px;padding:6px;font-size:13px" id="text" placeholder="Enter text to convert to lowercase or uppercase"/>
<br/><br/>
<input type="button" value="Lowercase" onClick="convertToLowercase();"/>
<input type="button" value="UpperCase" onClick="convertToUppercase();"/>
<br/><br/>
<input type="text" style="width:310px;padding:6px" id="result" placeholder="Result"/>
<script type="text/javascript">
function convertToLowercase() {
var data = document.getElementById("text").value;
var lowerCase = data.toLowerCase();
document.getElementById("result").value = lowerCase;
}
function convertToUppercase() {
var data = document.getElementById("text").value;
var upperCase = data.toUpperCase();
document.getElementById("result").value = upperCase;
}
</script>
</body>
</html>
- How to get UTC (GMT) time using JavaScript
- Submit html form on dropdown menu value selection or change using javascript
- How to detect Browser and Operating System Name and Version using JavaScript
- JavaScript : Get current page address
- [javaScript] Convert text case to lowercase
- How to check if a String contains substring or a word using javaScript
- Writing your first Hello, World! 🌍 JavaScript code Tutorial
- JavaScript: Check if variable is a number
- How to send email from JavaScript HTML using mailto
- Meaning of javascript:void(0) explained with example
- How to get query string in JavaScript HTML location.search
- Javascript convert text case from uppercase to lowercase
- Loading previous page using html button using JavaScript
- JavaScript : Get url protocol HTTP, HTTPS, FILE or FTP
- How to get current URL Location using Javascript HTML
- Detect if Cookies are enabled using JavaScript
- Write javaScript code in Swedish using FikaScript
- Add Animated Scrolling to Html Page Title Script
- JavaScript: Convert an Image into Base64 String
- Remove items from JavaScript array
- Send Extra Data with Ajax Get or Post Request
- How to Print from JavaScript HTML using window.print
- Get Device Screen Width and Height using javaScript
- Examples: Convert String to int in JavaScript
- npm WARN saveError ENOENT: no such file or directory, open /mnt/c/package.json
- How to press shortcut CTRL + ALT + DEL on Windows Remote Desktop - HowTos
- How to remove app from Dock when closed [macOS Big Sur] - MacOS
- Get the Current Date using LocalDate in Java - Java
- Eclipse : A java Runtime Environment (JRE) or Java Development kit (JDK) must be available - Java
- Difference between using Scanner Class and String args for user input in Java - Java
- How to delete a dir or folder using Python code - Python
- Android: programmatically turn Bluetooth on or off using Java code - Android
- How to disable button in Bootstrap - Bootstrap