views:

51

answers:

4

where can i get informations how styles are written in jquery.

for example it is not the normal way z-index it is zIndex... and so on..

fontWeight..

+2  A: 

It's not jQuery, it's the way JavaScript handles it.

Here's a chart:

http://codepunk.hardwar.org.uk/css2js.htm

Diodeus
likes this answer..
Sven Klouem
+3  A: 

No need. You can use the CSS style.

$("#ID").css({
    'z-index': 100,
    'height': '100px'
});
ChaosPandion
also likes this answer..
Sven Klouem
are you sure.. if this works for every possible property?
Sven Klouem
Yes, I am very sure of this.
ChaosPandion
+1  A: 

It's very simple.

All dashes are replaced by camelCase.

Therefore, every time you see a dash, remove it and make the next letter upper case.

Alternatively, you can specify the styles as strings within the JSON keys, and use exactly the same names as CSS.

For example: { "z-index": 4, "background-color": "red" }.

SLaks
One notable exception is `float` (styleFloat/cssFloat). I think there might be one or two other exceptions like this, but I can't think of any others right now...
Funka
In plain Javascript, that's true, but not in jQuery.
SLaks
A: 

See here also. I have seen cases where the browser (Safari) will only accept it with hyphen...

jQuery CSS

happytime harry