Show / Hide div

3

I have two links one is called links and the other information. My question is, how can I do with jquery that when I click on links a div appears and when I click on information the links div disappears and the div information appears.

The html code is as follows

<section class="botones">
    <div class="bloque_btn">
        <div class="btn btn_izq">
            <a href="#">enlaces</a>
        </div>
        <div class="btn btn_drch">
            <a href="#">información</a>
        </div>
    </div>
</section>
<section>
    <div id="bloque_enlaces"></div>
    <div id="bloque_info"></div>
</section>
    
asked by HaileyThc 21.04.2017 в 15:02
source

1 answer

3

You can do it this way:

$( document ).ready(function() {
    $( ".btn_izq" ).click(function() {
        $('#bloque_enlaces').show(); 
        $('#bloque_info').hide(); 
    });

    $( ".btn_drch" ).click(function() {
        $('#bloque_info').show(); 
        $('#bloque_enlaces').hide(); 
    });
});

This when you click one of the classes, it shows a div and the other one hides it: D

    
answered by 21.04.2017 / 15:09
source