I want to get the background property of my element. This is my code.
<!doctype html>
<html>
<head>
<style>
div#pt {
background: rgba(192,15,18,1.00);
width: 200px;
height: 200px;
}
</style>
</head>
<body>
<div id="pt" onClick="pick()"></div>
<script>
function pick() {
debugger;
var color = document.getElementById("pt").style.background;
}
</script>
</body>
</html>
I think this will work, but it doesn't work. It gives an empty string to color
variable. I think this is not the right way to get the value of background's property. So, kindly help me, how can i get the value of background's property.