Created
March 19, 2012 11:15
-
-
Save stenvdb/2107947 to your computer and use it in GitHub Desktop.
jQuery: Capitalize first letter of string
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$.fn.capitalize = function () { | |
$.each(this, function () { | |
var caps = this.value; | |
caps = caps.charAt(0).toUpperCase() + caps.slice(1); | |
this.value = caps; | |
}); | |
return this; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ddd