Changing the value of the first letter of each word

后端 未结 6 1105
我寻月下人不归
我寻月下人不归 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:33

    $(document).ready(function() {
        var words = $('h1').text().split(' ');
        var html = '';
        $.each(words, function() {
            html += ''+this.substring(0,1)+''+this.substring(1) + ' ';
        });
        $('h1').html(html);
    });
    

    Here's an example of it in action: http://jsfiddle.net/hCvsu/1/

提交回复
热议问题