Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript

is it correct ?

hey can i set css property through css like this

$(this).css({property:value,property:value});

2 Answers

I don't see why not.

Hey Ashish,

this should be possible, yes. For further informations you should check out the jQuery documentation on the css method here. There are multiple ways how you can set CSS properties via the css method. One way is to pass the css method an object with key-value pairs where the key is the CSS property and the value the value of this CSS property, so again: It should work! :)