I have a div of id = colors and inside it I have other divs with several classes
<div id="cores">
<div class="azul">conteúdo</div>
<div class="amarelo">conteúdo</div>
<div class="verde">conteúdo</div>
<div class="azul">conteúdo </div>
</div>
I would like to set up a function that would check how many divs with class defined and how many classes exist for each element.
I do not know if I made myself clear.
Solution of part one (Make an array only with class names). I found a solution with find:
var array_cores = [];
$("#cores").find('div').each(function(){
var classe = $(this).attr("class");
arrayObjetos.push({classe});
});
console.log(array_cores);
Generate a result like this;
var array_cores = ["azul", "amarelo", "verde", "azul"];
Now I need to count the repetitions