How can I remove a div container when the image is broken

I want to remove the whole container if the image src is broken, this is my code so far:

<template name="show_price_and_image">     
 <div class="container">
                    <div class="content">
                      {{> brandproductimages}}
              </div>
              <div class="imgDiv2">
                &nbsp;
              </div>
              <br/>
              <div class="fu-card__title mdl-typography--text-center">
                <h2 class="fu-card__title-text">
                  {{name}}
                </h2>
              </div>
              <div class="fu-card__price">
                {{> brandProductCurrencyPrice}}
             </div>
         </div>
  </div>
</template

<template name="image">

<img class="fu-productimg" src="{{image}}" alt="{{productname}}" title="{{productname}}"/>
</template>

How can I do this?

I’m guessing you want to check if image actually exists, as in the link is given and if th eimage loads. This sound like more complicated than anyone would need, what is it you’re trying to accomplish?

Exactly! but I’ve just solved this with a simple helper. No problem!

out of curiosity, what was the helper? code would be nice :slight_smile:

of course! :slightly_smiling:

  <div class="content">
                  {{#if image}}
                  <img class="fu-productimg" src="{{image}}" alt="{{productname}}" title="{{productname}}"/>
                  {{else}}
                  <img class="fu-img_not_found" src="/images/Product-image-not-found.svg" alt="{{productname}}" title="{{productname}}"/>
                  {{/if}}
</div>