This JQuery / Javascript function accepts a string parameter and converts it to proper case / title case
Function
function properCase(str) { return str.replace(/(?:^|\s)\w/g, function(match) { return match.toUpperCase(); }); }
Calling The Function
var text = "This is an example text"; alert(properCase(text));
Output
This Is An Example Text
Leave A comment
Email address is optional and will not be published. Only add email address if you want a reply from blog author.
Please fill required fields marked with *