Last Updated: January 28, 2019
·
803
· sensiblemnd

Ever wanted to Lowercase or Uppercase everything in certain DOM elements with jQuery?

This is how to do it. I know I could have made a plugin but im lazy right now.

$("element").each(
function(index, value) {
var textToLower = $(this).text();
$(this).text(textToLower.toLowerCase());
}
);

$("element").each(
function(index, value) {
var textToLower = $(this).text();
$(this).text(textToLower.toUpperCase());
}
);

2 Responses
Add your response

Why not just use css classes and the 'text-transform' property?

over 1 year ago ·

You could. But I wanted to do it in JS...

over 1 year ago ·