From 8f67bb1fb337f3ffa6690299038bbc29b708f5fa Mon Sep 17 00:00:00 2001 From: rjy7 Date: Fri, 2 Apr 2010 20:15:07 +0000 Subject: [PATCH] NIHVIVO-194 First draft of educational background form. Degree select doesn't get populated, so committing now so BrianC can take a look. --- webapp/web/js/extensions/String.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/webapp/web/js/extensions/String.js b/webapp/web/js/extensions/String.js index a14d6fa2a..867441a6c 100644 --- a/webapp/web/js/extensions/String.js +++ b/webapp/web/js/extensions/String.js @@ -2,4 +2,17 @@ String.prototype.capitalize = function() { return this.substring(0,1).toUpperCase() + this.substring(1); -}; \ No newline at end of file +}; + +String.prototype.capitalizeWords = function() { + var words = this.split(/\s+/), + wordCount = words.length, + i, + newWords = []; + + for (i = 0; i < wordCount; i++) { + newWords.push(words[i].capitalize()); + } + + return newWords.join(' '); +};