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
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#