Alert the background color of <p>. - Javascript jQuery Method and Property

Javascript examples for jQuery Method and Property:css

Description

Alert the background color of <p>.

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
    console.log($("p").css("background-color"));
});//ww w.j av a2s  .com
</script>
</head>
<body>

<p style="background-color:yellow;">This is a paragraph.</p>

</body>
</html>

Related Tutorials