I’m using a button to copy all text from an "input text area", but I need the text to be in uppercase and the script to format everything in lowercase.
How to make it uppercase?
function myFunction() {
// Get the text field
var copyText = document.getElementById("myInput");
// Select the text field
copyText.select();
copyText.setSelectionRange(0, 99999); // For mobile devices
// Copy the text inside the text field
navigator.clipboard.writeText(copyText.value);
}
2
Answers
You can use the
.toLowerCase()
And.toUpperCase()
functions to modify a string to be either fully lower or upper caseYou can try this, see the edit in last line: