Search code examples
javascriptbookmarkletlowercase

transform all text on page into Lower Case


I am looking for a method that transforms all text present on the page into LowerCase. I was reading an review and unfortunatelly the person has posted in all uppercase. I tried to read but all uppercase text is harder to read, not to mention it is considered shouting on the web.

I know javascript have methods such as string.toLowerCase() & string.replace But I can't figure it out.

so looking for some kind of JavaScript bookmarklet that converts all text into LowerCase on a already loeaded html page.

[Edit]

Found the solution, here javascript code to change the css style text-transform: lowercase for entire page:

var styleElement = document.createElement("style");
styleElement.type = "text/css";
if (styleElement.styleSheet) {
  styleElement.styleSheet.cssText = "* {  text-transform: lowercase }";
} else {
  styleElement.appendChild(document.createTextNode("* {  text-transform: lowercase; }"));
}
document.getElementsByTagName("head")[0].appendChild(styleElement);

Solution

  • If you are simply wanting to change html text to lowercase, you could do it with css.

    text-transform: lowercase;
    

    Would that work?