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());
}
);
Written by Rob
Related protips
2 Responses
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
·
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Javascript
Authors
Related Tags
#javascript
Did you know?
JavaScript on a page runs with the privileges of that origin. One altered library, tag manager, or snippet can read inputs, change what people see, and call your APIs as the user.
Security insights from Cside
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#