Solved
How can you use the 'toProperCase' function on a variable
Hi,
We would like to use the 'toProperCase' function on the <%= recipient.preferredName %>
But unsure of how to format it? Please could someone help!
Thanks,
Tutu
Hi,
We would like to use the 'toProperCase' function on the <%= recipient.preferredName %>
But unsure of how to format it? Please could someone help!
Thanks,
Tutu
First define the function like this
<%
String.prototype.toProperCase = function() {
var words = this.split(' ');
var results = [];
for (var i = 0; i < words.length; i++) {
var letter = words[i].charAt(0).toUpperCase();
results.push(letter + words[i].slice(1));
}
return results.join(' ');
};
%>Then you can use it like this
<%= recipient.preferredName.toProperCase() %>
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.