There is form-group
class in different div. But some of them contains form-group success
and some contains form-group error
class.
The class success
and error
are added from JavaScript
I want to log any text in console if all those div finally have form-group success
class.
I tried this
const formGroup = document.querySelectorAll('.form-group')
formGroup.forEach((item) => {
if (item.className === 'form-group success') {
console.log('cool')
}
})
But it is logging even if single div contains form-group success
class.
I want to log only when all div having form-group
class have form-group success