<div>I don't have any class, but at least one of my children has, so I have a border.
  <p class="any-class">Child with 'any-class'</p>
  <p>Child without any class</p>
  <p>Child without any class</p>
</div>
<br>
<div class="any-class">None of my children has any class, but I do have, so I have a border too.
  <p>Child without any class</p>
  <p>Child without any class</p>
  <p>Child without any class</p>
</div>
<br>
<div>Neither I nor any of my children have any class, so I have no border.
  <p>Child without class</p>
  <p>Child without class</p>
  <p>Child without class</p>
</div>
html {
  padding: 10px;
  font-size: 20px;
}
let items = document.querySelectorAll('.any-class');

for (let i = 0; i < items.length; i++) {
    	
	items[i].closest('div').style.border = '#fbdf00 solid 10px';

}

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.