How to hide an element in jQuery -


am having 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 hide div id (#imagesrc) when #image1 have src="", , show div (#imagesrc) when #image1 have src !=""?

try

       $(document).ready(function () {         if ($("#image1").attr("src") == "") {             $("#imagesrc").hide();         }         else {             $("#imagesrc").show();         }     }); 

update

$("#image1").change(function () { var imgcontrolname = "#imagesrc";  readurl(this, imgcontrolname);  if (jquery("#preview").attr("src") == "") {     jquery("#remove").hide(); } else {     jquery("#remove").show();  } }); 

demo


Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -