Am having the following code..
<img src="" id="image1" > <img src="www" id="image1" > <img src="" id="image2" > <img src="www" id="image2" > <div id="imagesrc"></div> How can I hide a div with an id (#imagesrc) when #image1 have src="", and show my div (#imagesrc) when #image1 have src !=""?
#imagesrccannot be shown and hidden at the same time. Or are these just examples, and there is only one element with the same ID and you just duplicated it to demonstrate that the element can have different values forsrc?$('#imagesrc').toggle($('#image1[src!='']').length > 0).