Capitalise the first letter of a group of words quickly & easily
It is best to place this code in the <head></head> tags after the jQuery library include link.
The following code will capitalise the first letter of each word which is in a header tag. A header tag looks like the following h1, h2, h3, h4, h5 and h6.
html = '';
words = $(this).text().split(' ');
html += '<span style="text-transform: uppercase;">' + this.substring(0,1) + '</span>' + this.substring(1) + ' ';
You can change the elements which are capitalised by adjusting the following line.
If you want to capitalise the first letter of each word within a “h1” tag change it to the following.
If you want to capitalise the first letter of each word which is within a element with a class of “title” change it to the following.