[Solved] if else with linked image


Here is an example:

if (getCookie("Account")=="True"){ 
  $('#img').attr('src', '/images/imageTrue.jpg');
} else { 
  $('#img').attr('src', '/images/imageFalse.jpg');
}

// your getCookie function
function getCookie(){
   return Math.random()*2>1?"True":"False";
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<a href="#" target="_blank"><img id="img" src="/images/imageTrue.jpg" alt="" />click me</a>

solved if else with linked image