jquery get CSS style property value

Use the below code to get the particular CSS style property value. Within the below example, its get and displaying the “background-color” value as “blue”.

           <div style="background-color:blue;"></div>
<script>
$( "div" ).click(function() {
                       var color = $( this ).css( "background-color" );
alert(color);  // Use this value
              });
</script>

Leave a Reply

Your email address will not be published. Required fields are marked *