lower to upper case

Posted on 2013-06-17
Last Modified: 2013-09-03
Hi experts,

Could you please provide a simple script to change lower to upper case for each field in a html form?

Question by:alcani
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
LVL 22

Expert Comment

by:Ivo Stoykov
ID: 39255285
Here is a variation:
    var inp = document.getElementsByTagName("input");
    for (var x = 0; x < inp.length; x++) {
        if (inp[x].getAttribute("type") != "text") {
        inp[x].value = inp[x].value.toLowerCase();

Open in new window


Ivo Stoykov
LVL 53

Expert Comment

by:Scott Fell, EE MVE
ID: 39255295
In css here is a working sample using a class you can attach to any element (div, p, span, li)

<!DOCTYPE html>
    .lowercase{text-transform: lowercase;}
<meta charset=utf-8 />
<title>JS Bin</title>
  <div><span class="lowercase">CONVERT THIS,</span> NOT THIS</div>

Open in new window

Serverside languages will have this property as well.  If you need to do mixed case, doing this serverside might be better, but this is quick and easy.
LVL 15

Expert Comment

by:Jagadishwor Dulal
ID: 39256235
Easy one Using Style:
<input type="text" name="name" id="name" onBlur="'uppercase';">

Open in new window


Accepted Solution

dimmergeek earned 500 total points
ID: 39293332
I believed you asked how to change TO UPPER CASE:

// Function to change case of input box value
function changeCase(el)
    var convertMe = document.getElementByID(el).value;
    var converted = convertMe.toUpperCase();
    document.getElementByID(el).value = converted;

Expert Comment

ID: 39461439

Featured Post

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Is your Office 365 signature not working the way you want it to? Are signature updates taking up too much of your time? Let's run through the most common problems that an IT administrator can encounter when dealing with Office 365 email signatures.
Originally, this post was published on Monitis Blog, you can check it here . Websites are getting bigger and more complicated by the day. Video, images and custom fonts are all great for showcasing your product or service. But the price to pay in…
In this tutorial viewers will learn how to position overlapping items using z-index in CSS. They will also learn the restrictions on the z-index property.  Create a new HTML document with an internal stylesheet.: Create a div in CSS and name it Red.…
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question