Set multiple CSS attributes for HTML element with jQuery

You can set multiple attributes for HTML element with jQuery.
1 2 3 4 |
$("#myControl").css({ 'color': 'red', 'background-color' : '#000' }); |
Another way to set multiple attributes for HTML element with jQuery is like this:
1 2 3 4 5 |
var cssObj = { 'background-color' : '#000', 'color' : 'red' } $("#myControl").css(cssObj); |