Description:

In this article, I will explain how to convert string to uppercase using Jquery.

toUpperCase() method is used to convert a string into uppercase.

toLowerCase() method is used to convert a string into lowercase.

We can bind this method with text box KeyUp() event. When user types anything, this method will change the text box value into uppercase or lowercase with each keystroke.

We can also convert first letter of each word to uppercase.


Example Program:

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
    <script type="text/javascript">
        $(document).ready(function () {
            $('#txtUpper').keyup(function () {
                this.value = this.value.toUpperCase();
            });
            $('#txtLower').keyup(function () {
                this.value = this.value.toLowerCase();
            });
        });
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:Label ID="lbltext" runat="server" Text="Enter Text:"></asp:Label>
        <asp:TextBox ID="txtUpper" runat="server"></asp:TextBox>
        <asp:TextBox ID="txtLower" runat="server"></asp:TextBox>
    </div>
    </form>
</body>
</html>

Lowercase and Uppercase with jQuery, Convert lowerCase to upperCase using jquery, Convert to upper case while typing, How to change a string into uppercase, Change text box value in uppercase or lowercase using jQuery

0 comments:

Post a Comment

 
Top