I'm trying to make a div element change background color when selecting the color of my input using Js. I'm not getting anyone to help me?
<style>
.corExemplo {
width: 150px;
height: 150px;
border-radius: 50%;
margin-bottom: 30px;
float: left;
}
</style>
<script>
function trocaCor(){
var cor = getElementById("corum").value;
document.getElementById("boxum").style.backgroundColor = cor;
}
</script>
<div id="boxum" class="corExemplo">Teste</div>
<form action="#" style="clear: both;">
<label for="corum">Cor 1</label>
<input type="color" id="corum" onchange="trocaCor();">
</form>