überprüfe, ob das Bild NICHT existiert, und verstecke ein Div

Wenn das Div ein Bild enthält, verstecken Sie es. Aber wenn das Bild existiert, muss ich das div sichtbar halten.

Aber es funktioniert nicht. Hier ist mein Code:

HTML:

<table id="FeatureBox">
    <tbody>
    <tr>
      <td>
        <div id="productInfoGrid">
          <div id="ProductIconsTitle">
            <p>PRODUCT FEATURES</p>
          </div><img width="563" height="337" src="http://www.preserveshop.co.uk/images/black-jam-jar-lid-58mm.jpg" alt="http://www.preserveshop.co.uk/images/black-jam-jar-lid-58mm.jpg" style="cursor: -moz-zoom-in"><div style="clear:both;"></div>
        </div>
      </td>
    </tr>
  </tbody>

JQUERY:

if ($("#div#productInfoGrid:not(img)").length) {
    $("#productInfoGrid").hide();
}

JSFIDDLE:http://jsfiddle.net/wJgpr/3/

Antworten auf die Frage(4)

Ihre Antwort auf die Frage