Sven Klouem
Sven Klouem

Reputation: 1

jquery and the style properties

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..

Upvotes: 0

Views: 87

Answers (4)

mothmonsterman
mothmonsterman

Reputation: 2481

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

jQuery CSS

Upvotes: 0

SLaks
SLaks

Reputation: 887255

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" }.

Upvotes: 1

ChaosPandion
ChaosPandion

Reputation: 78262

No need. You can use the CSS style.

$("#ID").css({
    'z-index': 100,
    'height': '100px'
});

Upvotes: 3

Diodeus - James MacFarlane
Diodeus - James MacFarlane

Reputation: 114347

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

Here's a chart:

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

Upvotes: 2

Related Questions