Skip to content

Instantly share code, notes, and snippets.

@dbowling
Created May 3, 2012 21:25
Show Gist options
  • Save dbowling/2589645 to your computer and use it in GitHub Desktop.
Save dbowling/2589645 to your computer and use it in GitHub Desktop.
Convert text to a valid CSS class name
string = 'Invalid C$$ class name';
string.replace(/[!\"#$%&'\(\)\*\+,\.\/:;<=>\?\@\[\\\]\^`\{\|\}~]/g, '').toLowerCase();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment