0

For example:

<div class="myel" style="border: dashed 1px #cc9900;background-color:#cc9900">Test</div>​

When i'm running this script:

alert( $("div.myel").css("background") );​

the result on firefox and chrome is :

rgb(204,153,0) none repate scroll 0% 0%


And for this script

alert( $("div.myel").css("background-color") );​

the result is :

rgb(204,153,0)

But when running this script:

alert( $("div.myel").css("border") );​

nothing appear on firefox but the result in chrome is:

dashed 1px rgb(204,153,0)

The same happens with alert($("div.myel").css("border-color"));​ and alert($("div.myel").css("borderColor"));​

j08691
  • 204,283
  • 31
  • 260
  • 272
Farok Ojil
  • 664
  • 1
  • 12
  • 22
  • that sounds weird, http://jsfiddle.net/2GrLP/ ? – Ram Jul 08 '12 at 20:30
  • thanks this will work if the css is built-in HTML but if it's in css file this script will not work – Farok Ojil Jul 08 '12 at 20:58
  • Of course that fiddle won't work with CSS. `.attr` retrieves HTML attributes, if you don't have a `style` attribute it won't retrieve anything. – Fabrício Matté Jul 08 '12 at 21:04
  • If you need to get at the style which is applied via an external stylesheet then this answer is what you want: http://stackoverflow.com/questions/754607/can-jquery-get-all-css-styles-associated-with-an-element – Bill Jul 08 '12 at 23:09
  • What's the actual question here? – j08691 Sep 30 '12 at 14:57

0 Answers0