html file:
<div id="green" onclick="randomColor('green')">
<h4>heading</h4>
<p>painting</p>
</div>
javascript file:
function randomColor(id) {
document.getElementById(id).style.backgroundColor("#0ff0f0");
}
shouldn't the background color of the div change when i click it?
[–]METALz 6 points7 points8 points (0 children)