It's simple but I can not do it. When I click on link1 show the div1, and if I click on link2 show the div2. And if I click on link1 again with div1 showing it should disappear, I know I have to use the toggle method but I can not.
$('.zik').click(function() {
$("#div1").hide();
$("#div2").hide();
});
$(".teste").click(function() {
$("#div1").toggle(
function() {
// $("#treta").hide();
},
function() {
// $("#treta").show();
});
$("#div2").toggle(
function() {
// $("#treta").hide();
},
function() {
// $("#treta").show();
});
});
#div1 {
height: 200px;
width: 200px;
background-color: red;
}
#div2 {
height: 200px;
width: 200px;
background-color: blue;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script><aid="link1" class="teste">link1</a>
<a id="link2" class="teste">link2</a>
<div id="div1">
</div>
<div id="div2">
</div>