[英]Append div to hidden elements in Angular using jquery
I have this div我有这个分区
<div class="col-md-4 solution" *ngIf="show">
</div>
which is by default hidden now on button click i want to show that div and append another div to the solution div
hide and show is working but append is not working for elements that are hidden.默认情况下现在隐藏在按钮上单击我想显示 div 和 append
solution div
隐藏和显示的另一个 div 正在工作,但 append 不适用于隐藏的元素。
this.show=true;
let area = $(".solution");
let Detail = `<div class="class-1">
<p>Text<p>
</</div>`;
area.append(Detail);
Any solution to append the div. append这个div的任何解决方案。 Thanks
谢谢
The .class
selector selects all elements with the specific class. .class
选择器选择具有特定 class 的所有元素。
area
is a collection of elements area
是元素的集合
var _that=this;
setTimeout(function(){
if($(".solution") && _that.show == true){// If solution div is visible/shown
let area = $('.solution:first')
let Detail = `<div class="class-1">
<p>Text<p>
</</div>`;
area.append(Detail);
}}, 200);
you need to append over the targeted div by element at index
.您需要 append 在目标 div 的元素上
index
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.