Angular:

http://angularjs.org/

by mrajcok

HTML

<div ng-controller="MyCtrl">
    <input type="text" ng-model="name" capitalize-first>
    <input type="text" ng-model="obj.name" capitalize-first>
</div>

JavaScript

var myApp = angular.module('myApp',[]);

myApp.directive('capitalizeFirst', function(uppercaseFilter, $parse) {
   return {
     require: 'ngModel',
     link: function(scope, element, attrs, modelCtrl) {
        var capitalize = function(inputValue) {
           var capitalized = inputValue.charAt(0).toUpperCase() +
               inputValue.substring(1);
           if(capitalized !== inputValue) {
              modelCtrl.$setViewValue(capitalized);
              modelCtrl.$render();
            }         
            return capitalized;
         }
         var model = $parse(attrs.ngModel);
         modelCtrl.$parsers.push(capitalize);
         capitalize(model(scope));
     }
   };
});

function MyCtrl($scope) {
    $scope.name = 'first';
    $scope.obj = {name: 'superhero'};
}