Tuesday, May 8, 2012

JavaScript - Only the first letter of the sentence capital as you type

A bit of tuning to some cool function that I found somewhere - now it's making the input text from lowercase to first letter capital all the rest are lowercase. My part of this neat function is that even if you type in all the letters capital still the result will be first letter capital and all the rest lowercase.



<asp:TextBox ID="tb_01" runat="server" onblur="this.value = this.value.substr(0, 1).toUpperCase() + this.value.substr(1).toLowerCase();"></asp:TextBox>



Enjoy!

No comments:

Post a Comment