In fact, I have 2 boxes, id named box1 and box2.
I am using J-query.
My design:
Click box1 => check box2 background color, if it is black, change it white, else change black.
My hard code:
<body>
<div id="box1"></div>
<div id="box2"></div>
</body>
$( document ).ready(function() {
$("#box1").click(function(){
if ($('#box2').css({backgroundColor: 'white'})) {
$('#box2').css({backgroundColor: 'black'});
} else {
$('#box2').css({backgroundColor: 'white'});
}
});
});