I have 4 divs and I have to apply the background for every of them according to this array of objects. I know the method css() but didn't know how to loop work.
[
{
"tix_type": "adult",
"bg": "gold",
"tix_pax": 1
},
{
"tix_type": "child",
"bg": "brown",
"tix_pax": 0
},
{
"tix_type": "senior",
"bg": "red",
"tix_pax": 2
},
{
"tix_type": "disabled",
"bg": "green",
"tix_pax": 1
}
]
There is no need for sequence, like 1 div is green, gold and 2 divs are red.