简体   繁体   English

jQuery:切换div的子级

[英]jquery: toggling the child of a div

I want to toggle all the content in a <div> : 我想切换<div>中的所有内容:

<div class="direccion">
    Dirección
    <div class="frm-section hide">            
        <label class="field prepend-icon">
            <input type="email" name="email" id="email" class="uit-input" placeholder="Dirección">
            <b class="uit-tooltip tip-left"><em>Dirección del paciente</em></b>
            <span class="field-icon"><i class="fa fa-envelope"></i></span>                      
        </label>
    </div><!-- end section -->

    <div class="frm-section hide">            
        <label class="field prepend-icon">
            <input type="email" name="email" id="email" class="uit-input" placeholder="No. Exterior">
            <b class="uit-tooltip tip-left"><em>Número exterior</em></b>
            <span class="field-icon"><i class="fa fa-envelope"></i></span>                      
        </label>
    </div><!-- end section -->
</div><!-- end direccion -->

I've tried multiple jQuery's on the forum, but none of the worked for me 我已经在论坛上尝试了多个jQuery,但没有一个适合我

Do you mean hide/show your .direccion content on a click of a button? 您是说单击按钮隐藏/显示.direccion内容吗? If so you can do it by using jQuery Toggle 如果是这样,您可以使用jQuery Toggle做到这一点

$( "#clickme" ).click(function() {
    $( ".direccion" ).toggle('fast');
});

Online example here 此处的在线示例

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM