Make string uppercase in jquery

## get ucfirst in jquery

## get first letter uppercase in jquery

 
<!-- 
Html Input box : starts -->

<p><input type="text" id="test" name="test"/></p>

<p><input type="text" id="foo" name="foo"/></p>

<!-- Html Input box : Ends -->



(function($) {

    $.ucfirst = function(str) {

  var text = str;
  var parts = text.split(' '),

 len = parts.length,

 i, words = [];

 for (i = 0; i < len; i++) {

  var part  = parts[i];

  var first  = part[0].toUpperCase();

   var rest  = part.substring(1, part.length);

  var word  = first + rest;
            words.push(word);

        }

        return words.join(' ');

    };


})(jQuery);


$('#test').blur(function() {

    var value = $(this).val();

    alert($.ucfirst(value));

});