JSFiddle - React, Tailwind, and code Playground
by Hemal Rathod
HTML
<input id="box" type="text" style="text-transform:capitalize">
<button id="showinput">type in something then press me</button>
JavaScript
$("#showinput").click(function(){
txt=$("#box").val();
var newtxt=txt.split(" ");
var tmp=[];
for(i=0;i<newtxt.length;i++)
{
tmp.push(newtxt[i].trim().charAt(0).toUpperCase()+ newtxt[i].slice(1));
}
alert(tmp.join().replace(","," ")+" as you can see, the first letter of each word is not capitalized!");
})