Home › Forums › JavaScript › How can I get CSS proerties of element with jquery ? › Reply To: How can I get CSS proerties of element with jquery ?
October 1, 2013 at 10:24 am
#151814
TheDoc
Member
I generally try to avoid manipulating the CSS directly with jQuery.
Instead of doing something like this:
$('.element').css({
border : '1px solid red',
background : 'blue
// etc
});
I’d rather to do this:
$('.element').addClass('something');
And then in your CSS file:
.something {
border: 1px solid red;
background: blue;
/* etc */
}
So instead of getting the CSS properties via jQuery, you should probably be figuring out how to utilize classes.