I am using this function to capitalize first letter of words in the string
function capitalizeFirstLetter(str) {
return str.replace(/\w\S*/g, function (txt) {
return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();
});
}
It works well for english words but when I try to type my word with non-English first letter, it makes first two letter to uppercase
Input string : "şanlıurfa"
Output string : "ŞAnlıurfa"
I just want to capitalize the first letter.
Thanks.