this is what I've done so far using CSS,Javascript and HTML.. if you click the red circle, it will change to yellow which is working but, I just want to add some functions, if the user clicks anywhere outside of the div, then the div will go back to its original color.
How can I do it?
here's my code:
HTML:
<html>
<body>
<div id="circle" name="color" onclick="changeColor()"></div>
</body>
</html>
CSS:
#circle{
height: 100px;
width: 100px;
border-radius: 100px;
background: #F00;
border: 2px solid ;
}
JS:
function changeColor() {
document.getElementsByName('color')[0].style.background="#FF0";
}
Thanks.. :)