jQuery to convert asp.net textbox text to uppercase or lowercase while typing

Introduction: In this article I am going to share how to automatically change text to upper or lower case while entering text in textbox using jquery.

jQuery to convert asp.net textbox text to uppercase or lowercase while typing

Description: Sometimes we want to restrict the user to enter text in specific case e.g. uppercase or lowercase . There are multiple ways to achieve this. Here I am sharing the trick using jquery. 

Implementation: Let’s create a demo page for demonstration purpose.

HTML Source
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
    <script type="text/javascript">
        $(document).ready(function () {
            // Convert text to Upper Case
            $('#<%=txtUpperCase.ClientID%>').keyup(function () {
                this.value = this.value.toUpperCase();
            // Convert text to Lower Case
            $('#<%=txtLowerCase.ClientID%>').keyup(function () {
                this.value = this.value.toLowerCase();
    <form id="form1" runat="server">
            <fieldset style="height: 80px; width: 345px;">
                <legend>Convert text to uppercase or lowercase while typing</legend>
                        <td>Text in upper case: </td>
                            <asp:TextBox ID="txtUpperCase" runat="server" /></td>
                        <td>Text in lower case: </td>
                            <asp:TextBox ID="txtLowerCase" runat="server" /></td>

Now over to you:
"A blog is nothing without reader's feedback and comments. So please provide your valuable feedback so that i can make this blog better and If you like my work; you can appreciate by leaving your comments, hitting Facebook like button, following on Google+, Twitter, Linkedin and Pinterest, stumbling my posts on stumble upon and subscribing for receiving free updates directly to your inbox . Stay tuned and stay connected for more technical updates."
Next Post »

If you have any question about any post, Feel free to ask.You can simply drop a comment below post or contact via Contact Us form. Your feedback and suggestions will be highly appreciated. Also try to leave comments from your account not from the anonymous account so that i can respond to you easily..