Here I will explain hoe to set unique background-color in div using jQuery. <html> <head> <title></title> <meta charset="utf-8" /> <script src="https://code.jquery.com/jquery-3.2.1.min.js"></script> <style type="text/css"> .bg-red { background-color: red; } .bg-pink { background-color: pink; } .bg-purple { background-color: purple; } .bg-green { background-color: green; } .bg-yellow { background-color: yellow; } .bg-lime { background-color: lime; } .bg-blue { background-color: blue; } div.activity_type { width: 100px; height: 100px; float: left; } </style> <script type="text/javascript"> $(document).ready(function () { var myColors = ['bg-red', 'bg-pink', 'bg-purple', 'bg-yellow', 'bg-gree
Here you can find solution of your code problem & errors.