.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Code Snippets >> Javascript >> Post New Resource Bookmark and Share   

 Subscribe to Code Snippets

Making first letter as capital through java script

Posted By:Gowthammanju       Posted Date: July 30, 2011    Points: 40    Category: Javascript    URL: http://www.dotnetspark.com  

This code explains about making of first letter capital while user enteres the values in text box
 

Here it is as


function InitCap(str)
        {
        var str = this.toLowerCase();
        var Rx = /\b([a-z']+)\b/gi;
        str = str.replace(Rx, function (w)
        {
            return w.charAt(0).toUpperCase() + w.substring(1);
        }
        );
        return str;
    }
call this function inside the text box which you want......

     

Further Readings:

Responses

No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More code samples in C#, ASP.Net, Vb.Net and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend