[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

lower to upper case

Posted on 2013-06-17
5
Medium Priority
?
364 Views
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?

Regards,
0
Comment
Question by:alcani
[X]
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
5 Comments
 
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") {
            continue;
        }
        inp[x].value = inp[x].value.toLowerCase();
    }

Open in new window

hth

Ivo Stoykov
0
 
LVL 54

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) http://jsbin.com/eferow/1/edit

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

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.
0
 
LVL 15

Expert Comment

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

Open in new window

0
 
LVL 7

Accepted Solution

by:
dimmergeek earned 2000 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;
}
0
 
LVL 7

Expert Comment

by:dimmergeek
ID: 39461439
Thanks!
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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.
In this blog, we’ll look at how improvements to Percona XtraDB Cluster improved IST performance.
In this tutorial viewers will learn how add a scalable full-width header using CSS3. Create a new HTML document with an internal stylesheet. Set a tiled background.:  Create a new div and name it Header. Position it with position:absolute at the top…
In this tutorial viewers will learn how to style transparent/translucent elements using alpha transparency in CSS Start with a normal styled element, such as a div.: Define its "background-color" property as "rgba (255, 255, 255, .5): The numbers in…
Suggested Courses

650 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