显示隐藏父级的div

时间:2014-09-11 15:25:00

标签: jquery html

如何显示隐藏父级的div?

<div class='hidden' style="display:none">
    <div class='visible' style="display:block">
        Div Content

    </div>
</div>

http://jsfiddle.net/5mnajstt/

1 个答案:

答案 0 :(得分:0)

<div class='hidden'>
<div class='visible'>
    Div Content     
</div>
</div>

<强> CSS

.hidden>div
{
    visibility: visible;
}

.hidden
{
    visibility: hidden;
}

<强> DEMO

您可以clone hidden div,然后append到另一个div。像这样:

<div class='hidden' style="display:none">
<div class='visible'>
    Div Content
</div>
</div>
<div id="dv"> </div>

$(document).ready(function () {
var element = jQuery('.visible').clone();
element.appendTo('#dv');
});

<强> DEMO