So what happens is that your event is seething with a house.
- A click appears on
div2 div2 The click function is called- he changes color
div1 - he assigns a click event to
div1 div2 ( return true)- DOM
div1div1 click
, , return false div2
: , JS , div2 100 , , div1 100 , .
(, , ):
$("#div2").click(function() {
$("#div1").css("background-color", "green");
return false;
});
$("#div1").click(function() {
$("#div1").css("background-color", "red");
});