Friday, June 14, 2013

How to convert textbox value to Uppercase Or Lowercase in using JavaScript

Introduction: In this I will explain how we can change the text to Uppercase or Lowercase using JavaScript in
Uppercase Or Lowercase

Put the below given JavaScript between Head tag of webform:
For Uppercase:

<script type="text/javascript">
        function Uppercase(id) {
            var txt = document.getElementById(id);
            txt.value = txt.value.replace(/\w\S*/g, function (txt) { return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase(); });

For Lowercase:

<script type="text/javascript">
        function Lowercase(id) {
            document.getElementById(id).value = document.getElementById(id).value.toLowerCase();

After that drag and drop the Textbox control from Toolbox and onkeyup call the JavaScript function. As shown below:

  <table border="1px dotted">
    <tr><td><b>Uppercase Example</b></td></tr>
    <tr><td>First Name:</td><td>
        <asp:TextBox ID="txtuppercase" runat="server" onkeyup="Uppercase("></asp:TextBox></td></tr>
        <tr><td><b>Lowercase Example</b></td></tr>
        <tr><td>First Name:</td><td><asp:TextBox ID="txtlowercase" runat="server" onkeyup="Lowercase("></asp:TextBox></td></tr>

Now run the project and check the result.

Is it helpful?

If yes post your comment to admire my work. You can like me on Facebook, Google+, Linkedin and Twitter via hit on Follow us Button and also can get update follow by Email.


  1. Howdy! I know this is somewhat off-topic however I had to
    ask. Does managing a well-established website such as yours require a
    lot of work? I am brand new to operating a blog however I do write in my diary daily.

    I'd like to start a blog so I can share my experience and feelings online.
    Please let me know if you have any kind of recommendations or tips for new aspiring blog owners.

    Feel free to surf to my web-site; Fine Dining Blog (

  2. Oh my goodness! Awesome article dude! Many thanks, However I am encountering issues with your RSS.
    I don't understand why I can't subscribe to it.
    Is there anybody else getting similar RSS issues? Anyone that knows the solution can you
    kindly respond? Thanks!!

    My blog ... seo