Convert first letter to uppercase on input box

后端 未结 8 1305
梦如初夏
梦如初夏 2020-12-11 04:38

JS Bin demo

This regex transform each lower case word to upper case. I have a full name input field. I do want the user to see that each word\'s first letter he/she

相关标签:
8条回答
  • 2020-12-11 05:39

    only use this This work for first name in capital char

    style="text-transform:capitalize;
    

    Like

    <asp:TextBox ID="txtName" style="text-transform:capitalize;" runat="server" placeholder="Your Name" required=""></asp:TextBox>
    
    0 讨论(0)
  • 2020-12-11 05:40
    val = val.substr(0, 1).toUpperCase() + val.substr(1);
    

    or:

    val = val.charAt(0).toUpperCase() + val.substr(1);
    
    0 讨论(0)
提交回复
热议问题