Get style property value using css() - Javascript jQuery

Javascript examples for jQuery:CSS

Description

Get style property value using css()

Demo Code

ResultView the demo in separate window

<html>
 <head> 
  <meta name="viewport" content="width=device-width, initial-scale=1"> 
  <script type="text/javascript" src="https://code.jquery.com/jquery-2.1.0.js"></script> 
  <style id="compiled-css" type="text/css">

.pen{/*from  w w  w .j  a v a 2  s  .c  o  m*/
   color:#333
}


      </style> 
  <script type="text/javascript">
    $(window).load(function(){
console.log($('.pen').css('color'))
    });

      </script> 
 </head> 
 <body> 
  <p class="pen" style="color:#000">abc</p>  
 </body>
</html>

Related Tutorials