Pull certain tags with attributes HTML : I am trying to pull certain item IDs based on if they have an image tag or not. For a given input like the one below:

    <div id="ID_1">
         <p><img src="image4.png"></p>
    </div>

    <div id="ID_2">
    </div>

    <div id="ID_3">
         <p><img src="image6.png"></p>
    </div>

    <div id="ID_4">
         <p><img src="image4.png"></p>
    </div>

I could get something like:

    ID_1: image4.png
    ID_2:
    ID_3: image6.png
    ID_4: image4.png

I am not too familiar with HTML or Javascript, so any help or resources that someone may have or know will be greatly appreciated.