JSFiddle - React, Tailwind, and code Playground

HTML

<div class="form-group">
  <input type="text" id="teste1" placeholder="Texto">
  <label for="teste1">Texto</label>
  <p class="help-block">Teste.</p>
</div>
<div class="form-group">
  <label>Texto</label>
  <p>Texto</p>
  <p class="help-block">Teste.</p>
</div>

CSS

.form-group {
  color: #fff;
  background-color: orange;
}

JavaScript

console.log($('.form-group'));

$('.form-group').each(function() {
	var primeiro = $(this).children().first();
	if($(primeiro).is('label')) {
  	console.log('true');
  	$(primeiro).parent().css('background-color', 'blue');
  }
});