function printClassForAllDivs()
{
var divs = $('div');
divs.each(function{
var klass = $(this).attr('class');
console.log('div class = '+klass);
});
}
It seems to me that this code should loop over all the divs and for each iteration of the loop a variable should be created to store the class, which is then printed to the console.
I’m afraid I don’t understand something about how to use the anonymous function.
function printClassForAllDivs()
{
var divs = $('div');
divs.each(function{
// what don't I understand about what I am permitted to do in here?
});
}
Thanks.
supposed to be