<div class="row align-items-center">
<div class="col-md-6"><img src="http://placehold.it/50x20" alt=""></div>
<div class="col-md-6">Текст</div>
</div>
<div class="row align-items-center">
<div class="col-md-6"><img src="http://placehold.it/50x20" alt=""></div>
<div class="col-md-6">Текст</div>
</div>
</div>
.order-md-2{
  background: red;
}

img{
  display: block;
}
let img = document.querySelectorAll("img");

img.forEach(function (el){
  el.parentElement.classList.add("order-md-2")
})

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.