Changing the value of the first letter of each word

后端 未结 6 1112
我寻月下人不归
我寻月下人不归 2020-12-06 18:14

I\'m attempting to either use jQuery, CSS or PHP to increase the font size of the first letter of each word in a string. For example, I\'m going to have a title in h1 tags

6条回答
  •  北荒
    北荒 (楼主)
    2020-12-06 18:31

    Here is the JSfiddle

    var h1 = $('h1'),
        words = h1.html().split(' '),
        withCaps = '';
    for (var i = 0; i < words.length; i++)
        withCaps += '' + words[i].substring(0, 1).toUpperCase() + '' + words[i].substring(1) + ' ';
    
    h1.html(withCaps);
    

提交回复
热议问题