JSFiddle - React, Tailwind, and code Playground
HTML
<div class="captial">
this text will be converted to each word having a capital letter in the beginning. a real treat
</div>
<div>
this text will stay lowercase
</div>
CSS
div{margin:20px;}
JavaScript
$('.captial').each(function(){
var arr = $(this).text().split(' ');
var result = "";
for (var x=0; x<arr.length; x++)
result+=arr[x].substring(0,1).toUpperCase()+arr[x].substring(1)+' ';
$(this).text(result.substring(0, result.length-1));
});