Hide/Show image on one click [closed]

http://jsfiddle.net/qYCUJ/ Try this

HTML

<button onclick="showhide_menu('btn1');">Show/Hide.  </button>

<button onclick="showhide_menu('btn2');">Show/Hide.  </button>

<div id="btn1" class="btn" style="display:none;">
<img src="http://healthystartups.com/storage/600px-MA_Route_1.png?__SQUARESPACE_CACHEVERSION=1319542839834"/>
</div>

<div id="btn2" class="btn" style="display:none;">
<img src="http://jenntgrace.com/wp-content/uploads/2012/12/2.png"/>
</div>

jQuery JS

window.showhide_menu = function(id){
$('.btn:not(#'+id+')').hide();
$("#" + id).toggle();
}

Leave a Comment