Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<head>
<script src="//code.jquery.com/jquery-2.1.1.min.js"></script>
    <link rel="stylesheet" type="text/css" href="stylesheet.css">
    <script type="text/javascript" src="myquery.js"></script>
</head>
<body>
    <div class="masterobject" id="obj1"></div>
    <div class="masterobject" id="obj2"></div>
    <div class="masterobject" id="obj3"></div>
    <div class="masterobject" id="obj4"></div>
    <div class="masterobject" id="obj5"></div>
</body>
 
.masterobject {
position: absolute;
background-color: red;
z-index: 2;
}
#obj1 {
width: 50px;
height: 60px;
top: 25%;
left: 19%;
}
#obj2 {
width: 150px;
height: 100px;
top: 12%;
left: 84%;
}
#obj3 {
width: 80px;
height: 80px;
top : 66%;
left : 73%;
}
#obj4 {
top: 54%;
left: 28%;
width: 60px;
height: 70px;
}
#obj5 {
width: 100px;
height: 100px;
top: 45%;
right: 13%;
}
 
$(document).ready(function() {
    var clicked = document.getElementsByClassName('clicked');
    var $masterObjects = $(".masterobject").click(function() {
        $(this).addClass("clicked");
        if ($masterObjects.length === clicked.length) {
             alert("all clicked");
        }
    });
});
Output

This bin was created anonymously and its free preview time has expired (learn why). — Get a free unrestricted account

Dismiss x
public
Bin info
anonymouspro
0viewers