I am trying to show/hide div when click on an image. when I click on the image nothing happens. What is wrong with my code
<script type="text/javascript">
$('#close').click(function(){
$('#main').show();
$('#login').hide();
});
</script>
<div style="float:right;"><a href="#">Close <img id="close" src="assets/close.png"></a></div>
Use the live function.
Also, I would target the a tag so the text also triggers it.