I have a yellow button.
When I click the button, I want to get the button's color.
I tried this:
<html>
<head>
<style rel="stylesheet">
.A {
background-color: #ffff00
}
</style>
<script>
function clicked() {
console.log(document.getElementById("A1").style.backgroundColor);
}
</script>
</head>
<body>
<input type="button" id="A1" class="A" value="1" onclick="clicked()">
</body>
</html>
then I got nothing.
How can I get 'yellow' or '#ffff00'?