bloqhead
3/19/2012 - 11:15 AM

jQuery: Capitalize first letter of string

jQuery: Capitalize first letter of string

$.fn.capitalize = function () {
    $.each(this, function () {
        var caps = this.value;
        caps = caps.charAt(0).toUpperCase() + caps.slice(1);
        this.value = caps;
    });
    return this;
};