camelCase OK for jQuery

CamelCase refers to a method of combining words into compound words. Instead of using a hyphen to connect two words, camelCase removes the hyphen or space between the words and capitalizes the second word.

jQuery doesn’t mind if you use camelCase when specifying CSS properties, so ‘border-color’ means the same as ‘borderColor’.

The hyphenated property name should always be used in CSS stylesheets, for example, background-color.
[plain]
.photos
{
background-color: #fff;
color: #000;
}
[/plain]

In jQuery either the hyphenated background-color or camelCase backgroundColor could be used.
[plain]
$(document).ready(function() {
$(‘#b1’).animate({
height: ‘+=100px’,
backgroundColor: ‘#eee’,
color:’#2133aa’
}, 2000, ‘linear’);
});
[/plain]

Tips:

  1. Single quote marks are needed if the hyphenated property is used, but the non-hyphenated camelCase doesn’t require single quotes around the property name.
  2. The values for each property should be inside single quotes.

Which case you’ll use comes down to personal preference. I like to type fewer quotes and hyphens, so I tend to use camelCase where ever possible.