NazariyM
1/10/2018 - 1:38 AM

add random color

.shape {
  display: inline-block;  
  width: 100px;
  height: 100px;
  border: 1px solid red;
}

#foo {
    background: black;
    color: white;    
    width: 100px;
    height: 40px;
    text-align: center;
    padding-top: 15px;

}
.blue {
  background: blue;
}
.yellow {
  bg yellow
}

    <div class="sq shape"></div>

    <div class="ci shape"></div>
 $(document).ready(function() {

            var names = [
                    "sq", "blue",
                    "ci", "yellow"
            ];

        $('.shape').each( function() {

            $( this ).addClass( names [Math.floor(Math.random() * names.length)] );
        });

    });