JavaScript CSS Helpers

function camelize(str) { return (str + "").replace(/-\D/g, function(match) { return match.charAt(1).toUpperCase(); }); } camelize("border-bottom-color"); // "borderBottomColor" function hyphenate(str) { return (str + "").replace(/[A-Z]/g, function(match) { return "-" + match.toLowerCase(); }); } hyphenate("borderBottomColor"); // "border-bottom-color"

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.