JavaScript
Article

jquery captialise text

By Sam Deering

Quick jQuery snippet to captialise text using a regex and the toUpperCase function.

$(this).val(txt.replace(/^(.)|s(.)/g, function($1)
{ 
    return $1.toUpperCase( ); 
}));

No Reader comments

Recommended
Sponsors
Because We Like You
Free Ebooks!

Grab SitePoint's top 10 web dev and design ebooks, completely free!

Get the latest in JavaScript, once a week, for free.