How do I use jquery's CSS attribute? -


i'm trying reset css, doesn't seem work although follows same structure detailed here: http://www.w3schools.com/jquery/css_css.asp

function labelreset(){ $(".year").css("color" : "#000", "opacity" : "0.5", "size" : "14px"); $(".dot").css("background-color" : "#000", "width" : "7px", "height" : "7px"); }; 

any thoughts?

you forgot use brackets {}:

 function labelreset(){ $(".year").css({"color" : "#000", "opacity" : "0.5", "size" : "14px"}); $(".dot").css({"background-color" : "#000", "width" : "7px", "height" : "7px"}); }; 

for single property: .css( propertyname, value ), multiple properties: .css( map ), check jquery api css.


Comments

Popular posts from this blog

javascript - backbone.js Collection.add() doesn't `construct` (`initialize`) an object -

php - Get uncommon values from two or more arrays -

Adding duplicate array rows in Php -