Revision: 25504
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at April 1, 2010 02:30 by nijgnet
Initial Code
jQuery.fn.addCaps = function() {
this.each(function ()
{
var words = $(this).html().split(" ");
for (var i=0; i<words.length; i++)
{
// add caps to first letter
var firstLetter = words[i].substr(0,1).replace(/(\w)/i, '<span class="cap">$1</span>');
words[i] = firstLetter + words[i].substr(1);
}
return $(this).html(words.join(" "));
});
}
Initial URL
Initial Description
Usage: `$(`selector`).addCaps();`
Initial Title
Set first-letter caps to style
Initial Tags
Initial Language
jQuery