0

How can I get all CSS properties in jQuery?

.test
{
  background-color:red;
  color:white;
  text-align:center;
  font-weight:bold;
}

<div class="test" >
Hello how are you
</div>

document.write($('.test').css('color'));

The above code gives me only the color value, but I want to show each property.

Patrick
  • 3,490
  • 1
  • 37
  • 64
Md. Parvez Alam
  • 4,326
  • 5
  • 48
  • 108
  • http://stackoverflow.com/questions/3965310/get-all-css-attributes-with-jquery – Rino Raj Jan 19 '16 at 09:33
  • Be aware using answer in duplicate, can fails on some cases and btw it doesn't return `!important` statment (expected behaviour). One other reason to not use this statement... See e.g the color here is white (due to CSS rule specificity) but green is returned and `!important` statement is just ommited: http://jsfiddle.net/t64jmzLv/ – A. Wolff Jan 19 '16 at 09:43

0 Answers0