jQuery Style How to - Get border top color








Question

We would like to know how to get border top color.

Answer


<!DOCTYPE html>
<html>
<head>
<script type='text/javascript'
  src='http://code.jquery.com/jquery-1.9.1.js'></script>
<style type='text/css'>
div {<!--  ww w  .j a v  a  2s .  c  o m-->
  width: 100px;
  height: 100px;
  border: 2px solid #05ff20;
}
</style>
<script type='text/javascript'>
$(window).load(function(){
    $("#clickme").click(function() {
        $('body').append($(this).css('border-top-color'));
    });
});
</script>
</head>
<body>
  <div id="clickme"></div>
</body>
</html>

The code above is rendered as follows: