Today, We want to share with you Capitalize First Letter JavaScript Example.In this post we will show you javascript capitalize, hear for javascript capitalize first letter of each word in array we will give you demo and example for implement.In this post, we will learn about javascript capitalize first letter with an example.
Capitalize First Letter JavaScript Demo
javascript capitalize first letter
simple Convert the first character of “hello infinityknow.com examples” to uppercase:
[php]
function capitalizeFirstLetter(mystr) {
return mystr.charAt(0).toUpperCase() + mystr.slice(1);
}
[/php]
javascript capitalize
How To Capitalize The First Letter Of A String using JavaScript
[php]
var firstLetter = string.charAt(0);
[/php]
Capitalizing first letter of each word in string
Simple JavaScript example to Capitalize First Letter of each particuler word of a given string.
HTML Code:
[php]
//This Example Output Here…
[/php]
JavaScript Code:
[php]
function capitalize_first_letter(mystr)
{
mystr = mystr.split(” “);
for (var i = 0, x = mystr.length; i < x; i++) { mystr[i] = mystr[i][0].toUpperCase() + mystr[i].substr(1); } return mystr.join(" "); } console.log(capitalize_first_letter("InfinityKnow Capitalize First Letter of each sentence using JavaScript.")); [/php]
javascript capitalize Example
CSS capitalize first letter
[php]
InfinityKnow Capitalize First Letter of each sentence using CSS
[/php]
[php]
p:first-letter {
text-transform:capitalize;
}
[/php]
jQuery 15 Powerful Tips and Tricks for Developers and Web Designer
Read :
Summary
You can also read about AngularJS, ASP.NET, VueJs, PHP.
I hope you get an idea about javascript capitalize first letter of each word.
I would like to have feedback on my Infinityknow.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.