Convert first letter to uppercase on input box

后端 未结 8 1316
梦如初夏
梦如初夏 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:40

    val = val.substr(0, 1).toUpperCase() + val.substr(1);
    

    or:

    val = val.charAt(0).toUpperCase() + val.substr(1);
    

提交回复
热议问题