JSFiddle - React, Tailwind, and code Playground

HTML

<div class="entry">
    <h1>Headline 1</h1>
    <p><img src="https://secure.gravatar.com/avatar/56453af3cc03c415ab18a6419f6b4d54?s=200&d=https://teamtreehouse.com/assets/content/default_avatar.gif&r=pg"/>Image? Yes</p>
    <p>Some Text that needs to stay put</p>
    <p>More copy text</p>
</div>

<div class="entry">
    <h1>Headline 2</h1>
    <p>Text in a non image entry</p>
    <p>This text has no image to keep it company</p>
</div>

<div class="entry">
    <h1>Headline 3</h1>
    <p><img src="https://bad.com"/>Another Image for Entries</p>
    <p>Keep this body text below</p>
    <p>Keep this text below the headline and image</p>
</div>

CSS

.home-p-img-adjust {
  color: blue;
}
.home-h1-adjust {
  color: red;
}

JavaScript

$('div.entry').each(function(){
    var $this = $(this);
    if($this.find('img').length > 0) {
        var theImage = $this.find('img');
        
        theImage.load(function(response, status){
            if(status == "error") {
              $(this).remove();
            } else {
              var $this = $(this).parents('div.entry');
                
              $this.find('h1').addClass('home-h1-adjust');   
              var $img = $this.find('p').first().addClass('home-p-img-adjust');
              $this.prepend($img);
            }
        }).each(function() {
          if(this.complete) $(this).load();
        });
    }
});