2
How do I select the background color of the div element?
Note: Using javascript
var cor;
cor = document.getElementById(id).style.backgroundColor;
#bloco1 {
width: 280px;
height: 120px;
border: 1px dashed black;
position: relative;
background-color: blue;
}
<!DOCTYPE html>
<html lang 'pt-br'>
<head>
<title>Pintar</title>
</head>
<body>
<div id='bloco1' onclick='selecionarCor(this.id)'></div>
</body>
</html>
I looked for examples on the subject, but it was not clear, now I understood. Thank you!
– Robison Aleixo
@Robisonalaxis great that I could help! If you want you can mark the answer as accepted.
– Sergio